| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "allegro/file.h" | ||
| 2 | #include "base/flags.h" | ||
| 3 | #include "base/util.h" | ||
| 4 | #include "base/version.h" | ||
| 5 | #include "base/zapp.h" | ||
| 6 | #include "base/qrs.h" | ||
| 7 | #include "base/cpool.h" | ||
| 8 | #include "base/autocombo.h" | ||
| 9 | #include "base/packfile.h" | ||
| 10 | #include "base/dmap.h" | ||
| 11 | #include "base/combo.h" | ||
| 12 | #include "base/msgstr.h" | ||
| 13 | #include "base/flags.h" | ||
| 14 | #include <filesystem> | ||
| 15 | #include <memory> | ||
| 16 | #include <optional> | ||
| 17 | #include <stdio.h> | ||
| 18 | #include <cstring> | ||
| 19 | #include <string> | ||
| 20 | #include <map> | ||
| 21 | #include <vector> | ||
| 22 | #include <assert.h> | ||
| 23 | #include <fmt/format.h> | ||
| 24 | |||
| 25 | |||
| 26 | #include "metadata/sigs/devsig.h.sig" | ||
| 27 | #include "metadata/sigs/compilersig.h.sig" | ||
| 28 | #include "metadata/versionsig.h" | ||
| 29 | #include "base/zc_alleg.h" | ||
| 30 | #include "base/zdefs.h" | ||
| 31 | #include "base/colors.h" | ||
| 32 | #include "tiles.h" | ||
| 33 | #include "base/zsys.h" | ||
| 34 | #include "base/qst.h" | ||
| 35 | #include "defdata.h" | ||
| 36 | #include "subscr.h" | ||
| 37 | #include "sfx.h" | ||
| 38 | #include "md5.h" | ||
| 39 | #include "zinfo.h" | ||
| 40 | #include "zc/ffscript.h" | ||
| 41 | #include "particles.h" | ||
| 42 | #include "dialog/alert.h" | ||
| 43 | #include "base/misctypes.h" | ||
| 44 | #include "base/initdata.h" | ||
| 45 | |||
| 46 | extern ZModule zcm; | ||
| 47 | extern zcmodule moduledata; | ||
| 48 | extern uint8_t __isZQuest; | ||
| 49 | extern sprite_list guys, items, Ewpns, Lwpns, chainlinks, decorations; | ||
| 50 | extern particle_list particles; | ||
| 51 | extern void setZScriptVersion(int32_t s_version); | ||
| 52 | |||
| 53 | static bool read_ext_zinfo = false, read_zinfo = false; | ||
| 54 | static bool loadquest_report = false; | ||
| 55 | static char const* loading_qst_name = NULL; | ||
| 56 | static std::string last_loaded_qstpath; | ||
| 57 | static byte loading_qst_num = 0; | ||
| 58 | static byte subscr_mode = ssdtMAX; | ||
| 59 | // Very old quests only used a byte for combos, and each screen had a "combo page" to vary | ||
| 60 | // what combos were used. This vector just lets us convert those old quests on load. | ||
| 61 | static std::vector<byte> old_combo_pages; | ||
| 62 | |||
| 63 | dword loading_tileset_flags = 0; | ||
| 64 | |||
| 65 | int32_t First[MAX_COMBO_COLS]={0},combo_alistpos[MAX_COMBO_COLS]={0},combo_pool_listpos[MAX_COMBO_COLS]={0},combo_auto_listpos[MAX_COMBO_COLS]={0}; | ||
| 66 | map_and_screen map_page[MAX_MAPPAGE_BTNS]= {{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}}; | ||
| 67 | |||
| 68 | #ifdef _MSC_VER | ||
| 69 | #define strncasecmp _strnicmp | ||
| 70 | #endif | ||
| 71 | |||
| 72 | #ifndef _AL_MALLOC | ||
| 73 | #define _AL_MALLOC(a) _al_malloc(a) | ||
| 74 | #define _AL_FREE(a) _al_free(a) | ||
| 75 | #endif | ||
| 76 | |||
| 77 | using std::string; | ||
| 78 | using std::pair; | ||
| 79 | |||
| 80 | extern int32_t hero_animation_speed; //lower is faster animation | ||
| 81 | extern byte *colordata; | ||
| 82 | extern tiledata *newtilebuf; | ||
| 83 | extern byte *trashbuf; | ||
| 84 | extern itemdata *itemsbuf; | ||
| 85 | extern wpndata *wpnsbuf; | ||
| 86 | extern comboclass *combo_class_buf; | ||
| 87 | extern guydata *guysbuf; | ||
| 88 | extern ZCHEATS zcheats; | ||
| 89 | extern char palnames[MAXLEVELS][17]; | ||
| 90 | extern char *byte_conversion(int32_t number, int32_t format); | ||
| 91 | extern char *byte_conversion2(int32_t number1, int32_t number2, int32_t format1, int32_t format2); | ||
| 92 | string zScript; | ||
| 93 | 366 | std::map<int32_t, script_slot_data > ffcmap; | |
| 94 | 366 | std::map<int32_t, script_slot_data > globalmap; | |
| 95 | 366 | std::map<int32_t, script_slot_data > genericmap; | |
| 96 | 366 | std::map<int32_t, script_slot_data > itemmap; | |
| 97 | 366 | std::map<int32_t, script_slot_data > npcmap; | |
| 98 | 366 | std::map<int32_t, script_slot_data > ewpnmap; | |
| 99 | 366 | std::map<int32_t, script_slot_data > lwpnmap; | |
| 100 | 366 | std::map<int32_t, script_slot_data > playermap; | |
| 101 | 366 | std::map<int32_t, script_slot_data > dmapmap; | |
| 102 | 366 | std::map<int32_t, script_slot_data > screenmap; | |
| 103 | 366 | std::map<int32_t, script_slot_data > itemspritemap; | |
| 104 | 366 | std::map<int32_t, script_slot_data > comboscriptmap; | |
| 105 | 366 | std::map<int32_t, script_slot_data > subscreenmap; | |
| 106 | void free_newtilebuf(); | ||
| 107 | bool combosread=false; | ||
| 108 | bool mapsread=false; | ||
| 109 | bool fixffcs=false; | ||
| 110 | bool fixpolsvoice=false; | ||
| 111 | |||
| 112 | 14793 | void script_slot_data::update() | |
| 113 | { | ||
| 114 |
2/5✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 14789 times.
|
14793 | switch (format) |
| 115 | { | ||
| 116 | case SCRIPT_FORMAT_INVALID: | ||
| 117 | 4 | output = fmt::format("{} --{}", slotname, scriptname); | |
| 118 | 4 | break; | |
| 119 | case SCRIPT_FORMAT_DISASSEMBLED: | ||
| 120 | ✗ | output = fmt::format("{} ++{}", slotname, scriptname); | |
| 121 | ✗ | break; | |
| 122 | case SCRIPT_FORMAT_ZASM: | ||
| 123 | ✗ | output = fmt::format("{} =={}", slotname, scriptname); | |
| 124 | ✗ | break; | |
| 125 | 14789 | case SCRIPT_FORMAT_DEFAULT: | |
| 126 | default: | ||
| 127 | 14789 | output = fmt::format("{} {}", slotname, scriptname); | |
| 128 | 14789 | } | |
| 129 | 14793 | } | |
| 130 | |||
| 131 | char qstdat_string[2048] = { 0 }; | ||
| 132 | |||
| 133 | static zinfo* load_tmp_zi = NULL; | ||
| 134 | |||
| 135 | int32_t memDBGwatch[8]= {0,0,0,0,0,0,0,0}; //So I can monitor memory crap | ||
| 136 | const byte clavio[9]={97,109,111,110,103,117,115,0}; | ||
| 137 | |||
| 138 | //enum { qe_OK, qe_notfound, qe_invalid, qe_version, qe_obsolete, | ||
| 139 | // qe_missing, qe_internal, qe_pwd, qe_match, qe_minver }; | ||
| 140 | |||
| 141 | const char *qst_error[] = | ||
| 142 | { | ||
| 143 | "OK","File not found","Invalid quest file", | ||
| 144 | "Version not supported","Obsolete version", | ||
| 145 | "Missing new data" , /* but let it pass in ZQuest */ | ||
| 146 | "Internal error occurred", "Invalid password", | ||
| 147 | "Quest title doesn't match saved game", "Save file is for older version of quest; please start new save", | ||
| 148 | "Out of memory", "File Debug Mode", "Canceled", "", "No quest assigned" | ||
| 149 | }; | ||
| 150 | |||
| 151 | //for legacy quests -DD | ||
| 152 | enum { ssiBOMB, ssiSWORD, ssiSHIELD, ssiCANDLE, ssiLETTER, ssiPOTION, ssiLETTERPOTION, ssiBOW, ssiARROW, ssiBOWANDARROW, ssiBAIT, ssiRING, ssiBRACELET, ssiMAP, | ||
| 153 | ssiCOMPASS, ssiBOSSKEY, ssiMAGICKEY, ssiBRANG, ssiWAND, ssiRAFT, ssiLADDER, ssiWHISTLE, ssiBOOK, ssiWALLET, ssiSBOMB, ssiHCPIECE, ssiAMULET, ssiFLIPPERS, | ||
| 154 | ssiHOOKSHOT, ssiLENS, ssiHAMMER, ssiBOOTS, ssiDIVINEFIRE, ssiDIVINEESCAPE, ssiDIVINEPROTECTION, ssiQUIVER, ssiBOMBBAG, ssiCBYRNA, ssiROCS, ssiHOVERBOOTS, | ||
| 155 | ssiSPINSCROLL, ssiCROSSSCROLL, ssiQUAKESCROLL, ssiWHISPRING, ssiCHARGERING, ssiPERILSCROLL, ssiWEALTHMEDAL, ssiHEARTRING, ssiMAGICRING, ssiSPINSCROLL2, | ||
| 156 | ssiQUAKESCROLL2, ssiAGONY, ssiSTOMPBOOTS, ssiWHIMSICALRING, ssiPERILRING, ssiMAX | ||
| 157 | }; | ||
| 158 | |||
| 159 | static byte deprecated_rules[QUESTRULES_NEW_SIZE]; | ||
| 160 | |||
| 161 | |||
| 162 | ✗ | char *byte_conversion(int32_t number, int32_t format) | |
| 163 | { | ||
| 164 | static char num_str[40]; | ||
| 165 | |||
| 166 | ✗ | if(format==-1) //auto | |
| 167 | { | ||
| 168 | ✗ | format=1; //bytes | |
| 169 | |||
| 170 | ✗ | if(number>1024) | |
| 171 | { | ||
| 172 | ✗ | format=2; //kilobytes | |
| 173 | ✗ | } | |
| 174 | |||
| 175 | ✗ | if(number>1024*1024) | |
| 176 | { | ||
| 177 | ✗ | format=3; //megabytes | |
| 178 | ✗ | } | |
| 179 | |||
| 180 | ✗ | if(number>1024*1024*1024) | |
| 181 | { | ||
| 182 | ✗ | format=4; //gigabytes (dude, what are you doing?) | |
| 183 | ✗ | } | |
| 184 | ✗ | } | |
| 185 | |||
| 186 | ✗ | switch(format) | |
| 187 | { | ||
| 188 | case 1: //bytes | ||
| 189 | ✗ | sprintf(num_str,"%db",number); | |
| 190 | ✗ | break; | |
| 191 | |||
| 192 | case 2: //kilobytes | ||
| 193 | ✗ | sprintf(num_str,"%.2fk",float(number)/1024); | |
| 194 | ✗ | break; | |
| 195 | |||
| 196 | case 3: //megabytes | ||
| 197 | ✗ | sprintf(num_str,"%.2fM",float(number)/(1024*1024)); | |
| 198 | ✗ | break; | |
| 199 | |||
| 200 | case 4: //gigabytes | ||
| 201 | ✗ | sprintf(num_str,"%.2fG",float(number)/(1024*1024*1024)); | |
| 202 | ✗ | break; | |
| 203 | |||
| 204 | default: | ||
| 205 | ✗ | abort(); | |
| 206 | break; | ||
| 207 | } | ||
| 208 | |||
| 209 | ✗ | return num_str; | |
| 210 | } | ||
| 211 | |||
| 212 | ✗ | char *byte_conversion2(int32_t number1, int32_t number2, int32_t format1, int32_t format2) | |
| 213 | { | ||
| 214 | static char num_str1[40]; | ||
| 215 | static char num_str2[40]; | ||
| 216 | static char num_str[80]; | ||
| 217 | |||
| 218 | ✗ | if(format1==-1) //auto | |
| 219 | { | ||
| 220 | ✗ | format1=1; //bytes | |
| 221 | |||
| 222 | ✗ | if(number1>1024) | |
| 223 | { | ||
| 224 | ✗ | format1=2; //kilobytes | |
| 225 | ✗ | } | |
| 226 | |||
| 227 | ✗ | if(number1>1024*1024) | |
| 228 | { | ||
| 229 | ✗ | format1=3; //megabytes | |
| 230 | ✗ | } | |
| 231 | |||
| 232 | ✗ | if(number1>1024*1024*1024) | |
| 233 | { | ||
| 234 | ✗ | format1=4; //gigabytes (dude, what are you doing?) | |
| 235 | ✗ | } | |
| 236 | ✗ | } | |
| 237 | |||
| 238 | ✗ | if(format2==-1) //auto | |
| 239 | { | ||
| 240 | ✗ | format2=1; //bytes | |
| 241 | |||
| 242 | ✗ | if(number2>1024) | |
| 243 | { | ||
| 244 | ✗ | format2=2; //kilobytes | |
| 245 | ✗ | } | |
| 246 | |||
| 247 | ✗ | if(number2>1024*1024) | |
| 248 | { | ||
| 249 | ✗ | format2=3; //megabytes | |
| 250 | ✗ | } | |
| 251 | |||
| 252 | ✗ | if(number2>1024*1024*1024) | |
| 253 | { | ||
| 254 | ✗ | format2=4; //gigabytes (dude, what are you doing?) | |
| 255 | ✗ | } | |
| 256 | ✗ | } | |
| 257 | |||
| 258 | ✗ | switch(format1) | |
| 259 | { | ||
| 260 | case 1: //bytes | ||
| 261 | ✗ | sprintf(num_str1,"%db",number1); | |
| 262 | ✗ | break; | |
| 263 | |||
| 264 | case 2: //kilobytes | ||
| 265 | ✗ | sprintf(num_str1,"%.2fk",float(number1)/1024); | |
| 266 | ✗ | break; | |
| 267 | |||
| 268 | case 3: //megabytes | ||
| 269 | ✗ | sprintf(num_str1,"%.2fM",float(number1)/(1024*1024)); | |
| 270 | ✗ | break; | |
| 271 | |||
| 272 | case 4: //gigabytes | ||
| 273 | ✗ | sprintf(num_str1,"%.2fG",float(number1)/(1024*1024*1024)); | |
| 274 | ✗ | break; | |
| 275 | |||
| 276 | default: | ||
| 277 | ✗ | abort(); | |
| 278 | break; | ||
| 279 | } | ||
| 280 | |||
| 281 | ✗ | switch(format2) | |
| 282 | { | ||
| 283 | case 1: //bytes | ||
| 284 | ✗ | sprintf(num_str2,"%db",number2); | |
| 285 | ✗ | break; | |
| 286 | |||
| 287 | case 2: //kilobytes | ||
| 288 | ✗ | sprintf(num_str2,"%.2fk",float(number2)/1024); | |
| 289 | ✗ | break; | |
| 290 | |||
| 291 | case 3: //megabytes | ||
| 292 | ✗ | sprintf(num_str2,"%.2fM",float(number2)/(1024*1024)); | |
| 293 | ✗ | break; | |
| 294 | |||
| 295 | case 4: //gigabytes | ||
| 296 | ✗ | sprintf(num_str2,"%.2fG",float(number2)/(1024*1024*1024)); | |
| 297 | ✗ | break; | |
| 298 | |||
| 299 | default: | ||
| 300 | ✗ | abort(); | |
| 301 | break; | ||
| 302 | } | ||
| 303 | |||
| 304 | ✗ | sprintf(num_str, "%s/%s", num_str1, num_str2); | |
| 305 | ✗ | return num_str; | |
| 306 | } | ||
| 307 | |||
| 308 | ✗ | char *ordinal(int32_t num) | |
| 309 | { | ||
| 310 | static const char *ending[4] = {"st","nd","rd","th"}; | ||
| 311 | static char ord_str[8]; | ||
| 312 | |||
| 313 | char *end; | ||
| 314 | ✗ | int32_t t=(num%100)/10; | |
| 315 | ✗ | int32_t n=num%10; | |
| 316 | |||
| 317 | ✗ | if(n>=1 && n<4 && t!=1) | |
| 318 | ✗ | end = (char *)ending[n-1]; | |
| 319 | else | ||
| 320 | ✗ | end = (char *)ending[3]; | |
| 321 | |||
| 322 | ✗ | sprintf(ord_str,"%d%s",num%10000,end); | |
| 323 | ✗ | return ord_str; | |
| 324 | } | ||
| 325 | |||
| 326 | ✗ | int32_t get_version_and_build(PACKFILE *f, word *version, word *build) | |
| 327 | { | ||
| 328 | int32_t ret; | ||
| 329 | ✗ | *version=0; | |
| 330 | ✗ | *build=0; | |
| 331 | ✗ | byte temp_map_count=map_count; | |
| 332 | byte temp_midi_flags[MIDIFLAGS_SIZE]; | ||
| 333 | ✗ | memcpy(temp_midi_flags, midi_flags, MIDIFLAGS_SIZE); | |
| 334 | |||
| 335 | zquestheader tempheader; | ||
| 336 | |||
| 337 | ✗ | if(!f) | |
| 338 | { | ||
| 339 | ✗ | return qe_invalid; | |
| 340 | } | ||
| 341 | |||
| 342 | ✗ | ret=readheader(f, &tempheader); | |
| 343 | |||
| 344 | ✗ | if(ret) | |
| 345 | { | ||
| 346 | ✗ | return ret; | |
| 347 | } | ||
| 348 | |||
| 349 | ✗ | map_count=temp_map_count; | |
| 350 | ✗ | memcpy(midi_flags, temp_midi_flags, MIDIFLAGS_SIZE); | |
| 351 | ✗ | *version=tempheader.zelda_version; | |
| 352 | ✗ | *build=tempheader.build; | |
| 353 | ✗ | return 0; | |
| 354 | ✗ | } | |
| 355 | |||
| 356 | |||
| 357 | ✗ | bool find_section(PACKFILE *f, int32_t section_id_requested) | |
| 358 | { | ||
| 359 | |||
| 360 | ✗ | if(!f) | |
| 361 | { | ||
| 362 | ✗ | return false; | |
| 363 | } | ||
| 364 | |||
| 365 | int32_t section_id_read; | ||
| 366 | ✗ | bool catchup=false; | |
| 367 | word dummy; | ||
| 368 | byte tempbyte; | ||
| 369 | char tempbuf[65536]; | ||
| 370 | |||
| 371 | |||
| 372 | ✗ | switch(section_id_requested) | |
| 373 | { | ||
| 374 | case ID_RULES: | ||
| 375 | case ID_STRINGS: | ||
| 376 | case ID_MISC: | ||
| 377 | case ID_TILES: | ||
| 378 | case ID_COMBOS: | ||
| 379 | case ID_CSETS: | ||
| 380 | case ID_MAPS: | ||
| 381 | case ID_DMAPS: | ||
| 382 | case ID_DOORS: | ||
| 383 | case ID_ITEMS: | ||
| 384 | case ID_WEAPONS: | ||
| 385 | case ID_COLORS: | ||
| 386 | case ID_ICONS: | ||
| 387 | case ID_INITDATA: | ||
| 388 | case ID_GUYS: | ||
| 389 | case ID_MIDIS: | ||
| 390 | case ID_CHEATS: | ||
| 391 | ✗ | break; | |
| 392 | |||
| 393 | default: | ||
| 394 | ✗ | al_trace("Bad section requested!\n"); | |
| 395 | ✗ | return false; | |
| 396 | break; | ||
| 397 | } | ||
| 398 | |||
| 399 | dword section_size; | ||
| 400 | |||
| 401 | //section id | ||
| 402 | ✗ | if(!p_mgetl(§ion_id_read,f)) | |
| 403 | { | ||
| 404 | ✗ | return false; | |
| 405 | } | ||
| 406 | |||
| 407 | ✗ | while(!pack_feof(f)) | |
| 408 | { | ||
| 409 | ✗ | switch(section_id_read) | |
| 410 | { | ||
| 411 | case ID_RULES: | ||
| 412 | case ID_STRINGS: | ||
| 413 | case ID_MISC: | ||
| 414 | case ID_TILES: | ||
| 415 | case ID_COMBOS: | ||
| 416 | case ID_CSETS: | ||
| 417 | case ID_MAPS: | ||
| 418 | case ID_DMAPS: | ||
| 419 | case ID_DOORS: | ||
| 420 | case ID_ITEMS: | ||
| 421 | case ID_WEAPONS: | ||
| 422 | case ID_COLORS: | ||
| 423 | case ID_ICONS: | ||
| 424 | case ID_INITDATA: | ||
| 425 | case ID_GUYS: | ||
| 426 | case ID_MIDIS: | ||
| 427 | case ID_CHEATS: | ||
| 428 | ✗ | catchup=false; | |
| 429 | ✗ | break; | |
| 430 | |||
| 431 | default: | ||
| 432 | ✗ | break; | |
| 433 | } | ||
| 434 | |||
| 435 | |||
| 436 | ✗ | while(catchup) | |
| 437 | { | ||
| 438 | //section id | ||
| 439 | ✗ | section_id_read=(section_id_read<<8); | |
| 440 | |||
| 441 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 442 | { | ||
| 443 | ✗ | return false; | |
| 444 | } | ||
| 445 | |||
| 446 | ✗ | section_id_read+=tempbyte; | |
| 447 | } | ||
| 448 | |||
| 449 | ✗ | if(section_id_read==section_id_requested) | |
| 450 | { | ||
| 451 | ✗ | return true; | |
| 452 | } | ||
| 453 | else | ||
| 454 | { | ||
| 455 | //section version info | ||
| 456 | ✗ | if(!p_igetw(&dummy,f)) | |
| 457 | { | ||
| 458 | ✗ | return false; | |
| 459 | } | ||
| 460 | |||
| 461 | ✗ | if(!p_igetw(&dummy,f)) | |
| 462 | { | ||
| 463 | ✗ | return false; | |
| 464 | } | ||
| 465 | |||
| 466 | //section size | ||
| 467 | ✗ | if(!p_igetl(§ion_size,f)) | |
| 468 | { | ||
| 469 | ✗ | return false; | |
| 470 | } | ||
| 471 | |||
| 472 | //pack_fseek(f, section_size); | ||
| 473 | ✗ | while(section_size>65535) | |
| 474 | { | ||
| 475 | ✗ | pfread(tempbuf,65535,f); | |
| 476 | ✗ | tempbuf[65535]=0; | |
| 477 | ✗ | section_size-=65535; | |
| 478 | } | ||
| 479 | |||
| 480 | ✗ | if(section_size>0) | |
| 481 | { | ||
| 482 | ✗ | pfread(tempbuf,section_size,f); | |
| 483 | ✗ | tempbuf[section_size]=0; | |
| 484 | ✗ | } | |
| 485 | } | ||
| 486 | |||
| 487 | //section id | ||
| 488 | ✗ | if(!p_mgetl(§ion_id_read,f)) | |
| 489 | { | ||
| 490 | ✗ | return false; | |
| 491 | } | ||
| 492 | } | ||
| 493 | |||
| 494 | ✗ | return false; | |
| 495 | ✗ | } | |
| 496 | |||
| 497 | |||
| 498 | |||
| 499 | |||
| 500 | |||
| 501 | ✗ | bool valid_zqt(PACKFILE *f) | |
| 502 | { | ||
| 503 | |||
| 504 | //word tiles_used; | ||
| 505 | //word combos_used; | ||
| 506 | //open the file | ||
| 507 | //PACKFILE *f = pack_fopen(path, F_READ_PACKED); | ||
| 508 | ✗ | if(!f) | |
| 509 | ✗ | return false; | |
| 510 | |||
| 511 | //for now, everything else is valid | ||
| 512 | ✗ | return true; | |
| 513 | |||
| 514 | /*int16_t version; | ||
| 515 | byte build; | ||
| 516 | |||
| 517 | //read the version and make sure it worked | ||
| 518 | if(!p_igetw(&version,f)) | ||
| 519 | { | ||
| 520 | goto error; | ||
| 521 | } | ||
| 522 | |||
| 523 | //read the build and make sure it worked | ||
| 524 | if(!p_getc(&build,f)) | ||
| 525 | goto error; | ||
| 526 | |||
| 527 | //read the tile info and make sure it worked | ||
| 528 | if(!p_igetw(&tiles_used,f)) | ||
| 529 | { | ||
| 530 | goto error; | ||
| 531 | } | ||
| 532 | |||
| 533 | for (int32_t i=0; i<tiles_used; i++) | ||
| 534 | { | ||
| 535 | if(!pfread(trashbuf,tilesize(tf4Bit),f)) | ||
| 536 | { | ||
| 537 | goto error; | ||
| 538 | } | ||
| 539 | } | ||
| 540 | |||
| 541 | //read the combo info and make sure it worked | ||
| 542 | if(!p_igetw(&combos_used,f)) | ||
| 543 | { | ||
| 544 | goto error; | ||
| 545 | } | ||
| 546 | for (int32_t i=0; i<combos_used; i++) | ||
| 547 | { | ||
| 548 | if(!pfread(trashbuf,sizeof(newcombo),f)) | ||
| 549 | { | ||
| 550 | goto error; | ||
| 551 | } | ||
| 552 | } | ||
| 553 | |||
| 554 | //read the palette info and make sure it worked | ||
| 555 | for (int32_t i=0; i<48; i++) | ||
| 556 | { | ||
| 557 | if(!pfread(trashbuf,newpdTOTAL,f)) | ||
| 558 | { | ||
| 559 | goto error; | ||
| 560 | } | ||
| 561 | } | ||
| 562 | if(!pfread(trashbuf,sizeof(palcycle)*256*3,f)) | ||
| 563 | { | ||
| 564 | goto error; | ||
| 565 | } | ||
| 566 | for (int32_t i=0; i<MAXLEVELS; i++) | ||
| 567 | { | ||
| 568 | if(!pfread(trashbuf,PALNAMESIZE,f)) | ||
| 569 | { | ||
| 570 | goto error; | ||
| 571 | } | ||
| 572 | } | ||
| 573 | |||
| 574 | //read the sprite info and make sure it worked | ||
| 575 | for (int32_t i=0; i<MAXITEMS; i++) | ||
| 576 | { | ||
| 577 | if(!pfread(trashbuf,sizeof(itemdata),f)) | ||
| 578 | { | ||
| 579 | goto error; | ||
| 580 | } | ||
| 581 | } | ||
| 582 | |||
| 583 | for (int32_t i=0; i<MAXWPNS; i++) | ||
| 584 | { | ||
| 585 | if(!pfread(trashbuf,sizeof(wpndata),f)) | ||
| 586 | { | ||
| 587 | goto error; | ||
| 588 | } | ||
| 589 | } | ||
| 590 | |||
| 591 | //read the triforce pieces info and make sure it worked | ||
| 592 | for (int32_t i=0; i<8; ++i) | ||
| 593 | { | ||
| 594 | if(!p_getc(&trashbuf,f)) | ||
| 595 | { | ||
| 596 | goto error; | ||
| 597 | } | ||
| 598 | } | ||
| 599 | |||
| 600 | |||
| 601 | |||
| 602 | //read the game icons info and make sure it worked | ||
| 603 | for (int32_t i=0; i<4; ++i) | ||
| 604 | { | ||
| 605 | if(!p_igetw(&trashbuf,f)) | ||
| 606 | { | ||
| 607 | goto error; | ||
| 608 | } | ||
| 609 | } | ||
| 610 | |||
| 611 | //read the misc colors info and map styles info and make sure it worked | ||
| 612 | if(!pfread(trashbuf,sizeof(zcolors),f)) | ||
| 613 | { | ||
| 614 | goto error; | ||
| 615 | } | ||
| 616 | |||
| 617 | //read the template screens and make sure it worked | ||
| 618 | byte num_maps; | ||
| 619 | if(!p_getc(&num_maps,f)) | ||
| 620 | { | ||
| 621 | goto error; | ||
| 622 | } | ||
| 623 | for (int32_t i=0; i<TEMPLATES; i++) | ||
| 624 | { | ||
| 625 | if(!pfread(trashbuf,sizeof(mapscr),f)) | ||
| 626 | { | ||
| 627 | goto error; | ||
| 628 | } | ||
| 629 | } | ||
| 630 | if (num_maps>1) //dungeon templates | ||
| 631 | { | ||
| 632 | for (int32_t i=0; i<TEMPLATES; i++) | ||
| 633 | { | ||
| 634 | if(!pfread(trashbuf,sizeof(mapscr),f)) | ||
| 635 | { | ||
| 636 | goto error; | ||
| 637 | } | ||
| 638 | } | ||
| 639 | } | ||
| 640 | |||
| 641 | //yay! it worked! close the file and say everything was ok. | ||
| 642 | pack_fclose(f); | ||
| 643 | return true; | ||
| 644 | |||
| 645 | error: | ||
| 646 | pack_fclose(f); | ||
| 647 | return false;*/ | ||
| 648 | ✗ | } | |
| 649 | |||
| 650 | ✗ | bool valid_zqt(const char *filename) | |
| 651 | { | ||
| 652 | ✗ | PACKFILE *f=NULL; | |
| 653 | bool isvalid; | ||
| 654 | int32_t error; | ||
| 655 | ✗ | f=open_quest_file(&error, filename, false); | |
| 656 | |||
| 657 | ✗ | if(!f) | |
| 658 | { | ||
| 659 | // setPackfilePassword(NULL); | ||
| 660 | ✗ | return false; | |
| 661 | } | ||
| 662 | |||
| 663 | ✗ | isvalid=valid_zqt(f); | |
| 664 | |||
| 665 | ✗ | clear_quest_tmpfile(); | |
| 666 | ✗ | pack_fclose(f); | |
| 667 | |||
| 668 | // setPackfilePassword(NULL); | ||
| 669 | ✗ | return isvalid; | |
| 670 | ✗ | } | |
| 671 | |||
| 672 | /* | ||
| 673 | .qst file history | ||
| 674 | |||
| 675 | .qst files have always been compressed using allegro's packfiles. | ||
| 676 | |||
| 677 | At some point, an encoding layer was added. The two layers look like this: | ||
| 678 | |||
| 679 | 1) The top layer is from us. See decode_file_007. | ||
| 680 | [0-24] Preamble "Zelda Classic Quest File" | ||
| 681 | [25-28] Initial decoding seed value. | ||
| 682 | [29-X] Allegro-compressed payload (AKA "packed" file), but XOR'd based on seed value | ||
| 683 | [last 4] Checksum | ||
| 684 | |||
| 685 | 2) The bottom layer is a "compressed packed file" from Allegro 4. The entire payload | ||
| 686 | is XOR'd with a password (datapwd). Once that is undone, the first four bytes are "slh!", | ||
| 687 | followed by a lzss compressed representation of the payload (from allergo' packfile compression). | ||
| 688 | The oldest quests skip the password part. | ||
| 689 | |||
| 690 | Simply, the job of this function is to peel away the top layer. | ||
| 691 | |||
| 692 | With this second layer of encryption, the data isn't any more secure, and adds a significant delay | ||
| 693 | in opening and saving files. There is no version field, so they decryption key is | ||
| 694 | found via trial-by-error (very slow!) | ||
| 695 | |||
| 696 | There are other file types of interest: | ||
| 697 | - .zqt: quest template files, skips top-layer encryption pass | ||
| 698 | - .qsu: "unencoded" (and uncompressed) files; skips encryption and compression (also makes the longtan password moot) | ||
| 699 | - .qu?: same as above. automated backup files | ||
| 700 | - .qb?: same as above. automated backup files | ||
| 701 | - .qt?: compressed and encrypted (or not encrypted, as of May 2023) | ||
| 702 | |||
| 703 | May 2023: .qst files are now saved without the top layer encoding, and no allegro packfile password. The first bytes of these | ||
| 704 | files are now "slh!.AG ZC Enhanced Quest File". | ||
| 705 | The following command will take an existing qst file and upgrade it: `./zquest -unencrypt-qst <input> <output>` | ||
| 706 | */ | ||
| 707 | 690 | PACKFILE *open_quest_file(int32_t *open_error, const char *filename, bool show_progress) | |
| 708 | { | ||
| 709 |
2/2✓ Branch 0 taken 689 times.
✓ Branch 1 taken 1 times.
|
690 | if (show_progress) |
| 710 | { | ||
| 711 | 1 | box_start(1, "Loading Quest", get_zc_font(font_lfont), font, true); | |
| 712 | 1 | } | |
| 713 | |||
| 714 | 690 | auto unencrypted_result = try_open_maybe_legacy_encoded_file(filename, ENC_STR, nullptr, QH_NEWIDSTR, QH_IDSTR); | |
| 715 |
2/2✓ Branch 0 taken 255 times.
✓ Branch 1 taken 435 times.
|
690 | if (unencrypted_result.decoded_pf) |
| 716 | 255 | return unencrypted_result.decoded_pf; | |
| 717 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 435 times.
|
435 | if (unencrypted_result.not_found) |
| 718 | { | ||
| 719 | ✗ | *open_error = qe_notfound; | |
| 720 | ✗ | return nullptr; | |
| 721 | } | ||
| 722 | |||
| 723 | // Everything below here is legacy code - recently saved quest files will have | ||
| 724 | // returned by now. | ||
| 725 | // The only replay qst file that is still using this legacy encoding is `link_to_the_zelda.qst`. | ||
| 726 | |||
| 727 | // Note: although this is primarily for loading .qst files, it can also handle all of the | ||
| 728 | // file types mentioned in the comment above. No need to be told if the file being loaded | ||
| 729 | // is encrypted or compressed, we can do some simple and fast checks to determine how to load it. | ||
| 730 | 435 | bool top_layer_compressed = unencrypted_result.top_layer_compressed; | |
| 731 | 435 | bool compressed = unencrypted_result.compressed; | |
| 732 | 435 | bool encrypted = unencrypted_result.encrypted; | |
| 733 | |||
| 734 | char tmpfilename[L_tmpnam]; | ||
| 735 | 435 | temp_name(tmpfilename); | |
| 736 | char percent_done[30]; | ||
| 737 | 435 | int32_t current_method=0; | |
| 738 | |||
| 739 | PACKFILE *f; | ||
| 740 | 435 | const char *passwd= encrypted ? datapwd : ""; | |
| 741 | |||
| 742 | // oldquest flag is set when an unencrypted qst file is suspected. | ||
| 743 | 435 | bool oldquest = false; | |
| 744 | int32_t ret; | ||
| 745 | |||
| 746 |
1/2✓ Branch 0 taken 435 times.
✗ Branch 1 not taken.
|
435 | if(strcmp(filename, "default.qst")!=0) |
| 747 | { | ||
| 748 | 435 | box_out(filename); | |
| 749 | 435 | } | |
| 750 | else | ||
| 751 | { | ||
| 752 | ✗ | box_out("new quest"); // Or whatever | |
| 753 | } | ||
| 754 | 435 | box_out("..."); | |
| 755 | 435 | box_eol(); | |
| 756 | 435 | box_eol(); | |
| 757 | |||
| 758 |
1/2✓ Branch 0 taken 435 times.
✗ Branch 1 not taken.
|
435 | if(encrypted) |
| 759 | { | ||
| 760 | 435 | box_out("Decrypting..."); | |
| 761 | 435 | box_save_x(); | |
| 762 | 435 | ret = decode_file_007(filename, tmpfilename, ENC_STR, ENC_METHOD_MAX-1, top_layer_compressed, passwd); | |
| 763 | |||
| 764 |
2/2✓ Branch 0 taken 372 times.
✓ Branch 1 taken 63 times.
|
435 | if(ret) |
| 765 | { | ||
| 766 |
1/3✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
|
63 | switch(ret) |
| 767 | { | ||
| 768 | case 1: | ||
| 769 | ✗ | box_out("error."); | |
| 770 | ✗ | box_eol(); | |
| 771 | ✗ | box_end(true); | |
| 772 | ✗ | *open_error=qe_notfound; | |
| 773 | ✗ | return NULL; | |
| 774 | |||
| 775 | case 2: | ||
| 776 | ✗ | box_out("error."); | |
| 777 | ✗ | box_eol(); | |
| 778 | ✗ | box_end(true); | |
| 779 | ✗ | *open_error=qe_internal; | |
| 780 | ✗ | return NULL; | |
| 781 | // be sure not to delete tmpfilename now... | ||
| 782 | } | ||
| 783 | |||
| 784 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 63 times.
|
63 | if(ret==5) //old encryption? |
| 785 | { | ||
| 786 | 63 | current_method++; | |
| 787 | 63 | sprintf(percent_done, "%d%%", (current_method*100)/ENC_METHOD_MAX); | |
| 788 | 63 | box_out(percent_done); | |
| 789 | 63 | box_load_x(); | |
| 790 | 63 | ret = decode_file_007(filename, tmpfilename, ENC_STR, ENC_METHOD_211B9, strstr(filename, ".dat#")!=NULL, passwd); | |
| 791 | 63 | } | |
| 792 | |||
| 793 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 63 times.
|
63 | if(ret==5) //old encryption? |
| 794 | { | ||
| 795 | 63 | current_method++; | |
| 796 | 63 | sprintf(percent_done, "%d%%", (current_method*100)/ENC_METHOD_MAX); | |
| 797 | 63 | box_out(percent_done); | |
| 798 | 63 | box_load_x(); | |
| 799 | 63 | ret = decode_file_007(filename, tmpfilename, ENC_STR, ENC_METHOD_192B185, strstr(filename, ".dat#")!=NULL, passwd); | |
| 800 | 63 | } | |
| 801 | |||
| 802 |
2/2✓ Branch 0 taken 45 times.
✓ Branch 1 taken 18 times.
|
63 | if(ret==5) //old encryption? |
| 803 | { | ||
| 804 | 18 | current_method++; | |
| 805 | 18 | sprintf(percent_done, "%d%%", (current_method*100)/ENC_METHOD_MAX); | |
| 806 | 18 | box_out(percent_done); | |
| 807 | 18 | box_load_x(); | |
| 808 | 18 | ret = decode_file_007(filename, tmpfilename, ENC_STR, ENC_METHOD_192B105, strstr(filename, ".dat#")!=NULL, passwd); | |
| 809 | 18 | } | |
| 810 | |||
| 811 |
2/2✓ Branch 0 taken 51 times.
✓ Branch 1 taken 12 times.
|
63 | if(ret==5) //old encryption? |
| 812 | { | ||
| 813 | 12 | current_method++; | |
| 814 | 12 | sprintf(percent_done, "%d%%", (current_method*100)/ENC_METHOD_MAX); | |
| 815 | 12 | box_out(percent_done); | |
| 816 | 12 | box_load_x(); | |
| 817 | 12 | ret = decode_file_007(filename, tmpfilename, ENC_STR, ENC_METHOD_192B104, strstr(filename, ".dat#")!=NULL, passwd); | |
| 818 | 12 | } | |
| 819 | |||
| 820 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 63 times.
|
63 | if(ret) |
| 821 | { | ||
| 822 | ✗ | oldquest = true; | |
| 823 | ✗ | passwd=""; | |
| 824 | ✗ | } | |
| 825 | 63 | } | |
| 826 | |||
| 827 | 435 | box_out("okay."); | |
| 828 | 435 | box_eol(); | |
| 829 | 435 | } | |
| 830 | else | ||
| 831 | { | ||
| 832 | ✗ | oldquest = true; | |
| 833 | } | ||
| 834 | |||
| 835 | 435 | box_out("Opening..."); | |
| 836 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 435 times.
|
435 | f = pack_fopen_password(oldquest ? filename : tmpfilename, compressed ? F_READ_PACKED : F_READ, passwd); |
| 837 |
1/2✓ Branch 0 taken 435 times.
✗ Branch 1 not taken.
|
435 | if(!f) |
| 838 | { | ||
| 839 | ✗ | if((compressed==1)&&(errno==EDOM)) | |
| 840 | { | ||
| 841 | ✗ | f = pack_fopen_password(oldquest ? filename : tmpfilename, F_READ, passwd); | |
| 842 | ✗ | } | |
| 843 | |||
| 844 | ✗ | if(!f) | |
| 845 | { | ||
| 846 | ✗ | if(!oldquest) | |
| 847 | { | ||
| 848 | ✗ | delete_file(tmpfilename); | |
| 849 | ✗ | } | |
| 850 | ✗ | box_out("error."); | |
| 851 | ✗ | box_eol(); | |
| 852 | ✗ | box_end(true); | |
| 853 | ✗ | *open_error=qe_invalid; | |
| 854 | ✗ | return NULL; | |
| 855 | } | ||
| 856 | ✗ | } | |
| 857 | |||
| 858 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 435 times.
|
435 | if(!oldquest) |
| 859 | { | ||
| 860 | 435 | delete_file(tmpfilename); | |
| 861 | 435 | } | |
| 862 | |||
| 863 | 435 | box_out("okay."); | |
| 864 | 435 | box_eol(); | |
| 865 | |||
| 866 | 435 | return f; | |
| 867 | 690 | } | |
| 868 | |||
| 869 | ✗ | PACKFILE *open_quest_template(zquestheader *Header, const char *filename, bool validate) | |
| 870 | { | ||
| 871 | ✗ | PACKFILE *f=NULL; | |
| 872 | ✗ | int32_t open_error=0; | |
| 873 | |||
| 874 | ✗ | if (Header->templatepath[0] != 0) | |
| 875 | { | ||
| 876 | // TODO: should be safe to remove this, no one seems to use custom quest templates. | ||
| 877 | ✗ | filename=Header->templatepath; | |
| 878 | ✗ | } | |
| 879 | |||
| 880 | ✗ | f=open_quest_file(&open_error, filename, false); | |
| 881 | |||
| 882 | ✗ | if(!f) | |
| 883 | { | ||
| 884 | ✗ | return NULL; | |
| 885 | } | ||
| 886 | |||
| 887 | ✗ | if(validate) | |
| 888 | { | ||
| 889 | ✗ | if(!valid_zqt(f)) | |
| 890 | { | ||
| 891 | ✗ | jwin_alert("Error","Invalid Quest Template",NULL,NULL,"O&K",NULL,'k',0,get_zc_font(font_lfont)); | |
| 892 | ✗ | pack_fclose(f); | |
| 893 | ✗ | clear_quest_tmpfile(); | |
| 894 | ✗ | return NULL; | |
| 895 | } | ||
| 896 | ✗ | } | |
| 897 | |||
| 898 | ✗ | return f; | |
| 899 | ✗ | } | |
| 900 | |||
| 901 | ✗ | static bool init_section(zquestheader *Header, int32_t section_id, miscQdata *Misc, zctune *tunes, bool validate, const char* filename) | |
| 902 | { | ||
| 903 | // The only time the player uses this is to init tiles for some quests 1.90 or older. See readtiles. | ||
| 904 | ✗ | if (get_app_id() == App::zelda) | |
| 905 | ✗ | assert(section_id == ID_TILES); | |
| 906 | |||
| 907 | ✗ | combosread=false; | |
| 908 | ✗ | mapsread=false; | |
| 909 | ✗ | fixffcs=false; | |
| 910 | |||
| 911 | ✗ | switch(section_id) | |
| 912 | { | ||
| 913 | case ID_RULES: | ||
| 914 | case ID_STRINGS: | ||
| 915 | case ID_MISC: | ||
| 916 | case ID_TILES: | ||
| 917 | case ID_COMBOS: | ||
| 918 | case ID_CSETS: | ||
| 919 | case ID_MAPS: | ||
| 920 | case ID_DMAPS: | ||
| 921 | case ID_DOORS: | ||
| 922 | case ID_ITEMS: | ||
| 923 | case ID_WEAPONS: | ||
| 924 | case ID_COLORS: | ||
| 925 | case ID_ICONS: | ||
| 926 | case ID_INITDATA: | ||
| 927 | case ID_GUYS: | ||
| 928 | case ID_MIDIS: | ||
| 929 | case ID_CHEATS: | ||
| 930 | case ID_ITEMDROPSETS: | ||
| 931 | case ID_FAVORITES: | ||
| 932 | ✗ | break; | |
| 933 | |||
| 934 | default: | ||
| 935 | ✗ | return false; | |
| 936 | break; | ||
| 937 | } | ||
| 938 | |||
| 939 | int32_t ret; | ||
| 940 | word version, build; | ||
| 941 | ✗ | PACKFILE *f=NULL; | |
| 942 | |||
| 943 | //why is this here? | ||
| 944 | /* | ||
| 945 | if(colordata==NULL) | ||
| 946 | return false; | ||
| 947 | */ | ||
| 948 | |||
| 949 | //setPackfilePassword(datapwd); | ||
| 950 | ✗ | f=open_quest_template(Header, filename, validate); | |
| 951 | |||
| 952 | ✗ | if(!f) //no file, nothing to delete | |
| 953 | { | ||
| 954 | // setPackfilePassword(NULL); | ||
| 955 | ✗ | return false; | |
| 956 | } | ||
| 957 | |||
| 958 | ✗ | ret=get_version_and_build(f, &version, &build); | |
| 959 | |||
| 960 | ✗ | if(ret||(version==0)) | |
| 961 | { | ||
| 962 | ✗ | pack_fclose(f); | |
| 963 | ✗ | clear_quest_tmpfile(); | |
| 964 | |||
| 965 | // setPackfilePassword(NULL); | ||
| 966 | ✗ | return false; | |
| 967 | } | ||
| 968 | |||
| 969 | ✗ | if(!find_section(f, section_id)) | |
| 970 | { | ||
| 971 | ✗ | al_trace("Can't find section!\n"); | |
| 972 | ✗ | pack_fclose(f); | |
| 973 | ✗ | clear_quest_tmpfile(); | |
| 974 | |||
| 975 | //setPackfilePassword(NULL); | ||
| 976 | ✗ | return false; | |
| 977 | } | ||
| 978 | |||
| 979 | ✗ | switch(section_id) | |
| 980 | { | ||
| 981 | case ID_RULES: | ||
| 982 | //rules | ||
| 983 | ✗ | ret=readrules(f, Header); | |
| 984 | ✗ | break; | |
| 985 | |||
| 986 | case ID_STRINGS: | ||
| 987 | //strings | ||
| 988 | ✗ | ret=readstrings(f, Header); | |
| 989 | ✗ | break; | |
| 990 | |||
| 991 | case ID_MISC: | ||
| 992 | //misc data | ||
| 993 | ✗ | ret=readmisc(f, Header, Misc); | |
| 994 | ✗ | break; | |
| 995 | |||
| 996 | case ID_TILES: | ||
| 997 | //tiles | ||
| 998 | ✗ | ret=readtiles(f, newtilebuf, Header, version, build, 0, NEWMAXTILES, true); | |
| 999 | ✗ | break; | |
| 1000 | |||
| 1001 | case ID_COMBOS: | ||
| 1002 | //combos | ||
| 1003 | ✗ | clear_combos(); | |
| 1004 | ✗ | ret=readcombos(f, Header, version, build, 0, MAXCOMBOS); | |
| 1005 | ✗ | combosread=true; | |
| 1006 | ✗ | break; | |
| 1007 | |||
| 1008 | case ID_COMBOALIASES: | ||
| 1009 | //combos | ||
| 1010 | ✗ | ret=readcomboaliases(f, Header, version, build); | |
| 1011 | ✗ | break; | |
| 1012 | |||
| 1013 | case ID_CSETS: | ||
| 1014 | //color data | ||
| 1015 | ✗ | ret=readcolordata(f, Misc, version, build, 0, newerpdTOTAL); | |
| 1016 | ✗ | break; | |
| 1017 | |||
| 1018 | case ID_MAPS: | ||
| 1019 | //maps | ||
| 1020 | ✗ | ret=readmaps(f, Header); | |
| 1021 | ✗ | mapsread=true; | |
| 1022 | ✗ | break; | |
| 1023 | |||
| 1024 | case ID_DMAPS: | ||
| 1025 | //dmaps | ||
| 1026 | ✗ | ret=readdmaps(f, Header, version, build, 0, MAXDMAPS); | |
| 1027 | ✗ | break; | |
| 1028 | |||
| 1029 | case ID_DOORS: | ||
| 1030 | //door combo sets | ||
| 1031 | ✗ | ret=readdoorcombosets(f, Header); | |
| 1032 | ✗ | break; | |
| 1033 | |||
| 1034 | case ID_ITEMS: | ||
| 1035 | //items | ||
| 1036 | ✗ | ret=readitems(f, version, build); | |
| 1037 | ✗ | break; | |
| 1038 | |||
| 1039 | case ID_WEAPONS: | ||
| 1040 | //weapons | ||
| 1041 | ✗ | ret=readweapons(f, Header); | |
| 1042 | ✗ | break; | |
| 1043 | |||
| 1044 | case ID_COLORS: | ||
| 1045 | //misc. colors | ||
| 1046 | ✗ | ret=readmisccolors(f, Header, Misc); | |
| 1047 | ✗ | break; | |
| 1048 | |||
| 1049 | case ID_ICONS: | ||
| 1050 | //game icons | ||
| 1051 | ✗ | ret=readgameicons(f, Header, Misc); | |
| 1052 | ✗ | break; | |
| 1053 | |||
| 1054 | case ID_INITDATA: | ||
| 1055 | //initialization data | ||
| 1056 | ✗ | ret=readinitdata(f, Header); | |
| 1057 | ✗ | break; | |
| 1058 | |||
| 1059 | case ID_GUYS: | ||
| 1060 | //guys | ||
| 1061 | ✗ | ret=readguys(f, Header); | |
| 1062 | ✗ | break; | |
| 1063 | |||
| 1064 | case ID_MIDIS: | ||
| 1065 | //midis | ||
| 1066 | ✗ | ret=readtunes(f, Header, tunes); | |
| 1067 | ✗ | break; | |
| 1068 | |||
| 1069 | case ID_CHEATS: | ||
| 1070 | //cheat codes | ||
| 1071 | ✗ | ret=readcheatcodes(f, Header); | |
| 1072 | ✗ | break; | |
| 1073 | |||
| 1074 | case ID_ITEMDROPSETS: | ||
| 1075 | //item drop sets | ||
| 1076 | // Why is this one commented out? | ||
| 1077 | //ret=readitemdropsets(f, (int32_t)version, (word)build); | ||
| 1078 | ✗ | break; | |
| 1079 | |||
| 1080 | case ID_FAVORITES: | ||
| 1081 | // favorite combos and aliases | ||
| 1082 | ✗ | ret=readfavorites(f, version, build); | |
| 1083 | ✗ | break; | |
| 1084 | |||
| 1085 | default: | ||
| 1086 | ✗ | ret=-1; | |
| 1087 | ✗ | break; | |
| 1088 | } | ||
| 1089 | |||
| 1090 | ✗ | pack_fclose(f); | |
| 1091 | ✗ | clear_quest_tmpfile(); | |
| 1092 | |||
| 1093 | //setPackfilePassword(NULL); | ||
| 1094 | ✗ | if(!ret) | |
| 1095 | { | ||
| 1096 | ✗ | return true; | |
| 1097 | } | ||
| 1098 | |||
| 1099 | ✗ | return false; | |
| 1100 | ✗ | } | |
| 1101 | |||
| 1102 | ✗ | bool init_tiles_for_190(bool validate, zquestheader *Header) | |
| 1103 | { | ||
| 1104 | ✗ | return init_section(Header, ID_TILES, NULL, NULL, validate, "modules/classic/classic_1st.qst"); | |
| 1105 | } | ||
| 1106 | |||
| 1107 | ✗ | bool init_tiles(bool validate, zquestheader *Header) | |
| 1108 | { | ||
| 1109 | ✗ | return init_section(Header, ID_TILES, NULL, NULL, validate, "modules/classic/default.qst"); | |
| 1110 | } | ||
| 1111 | |||
| 1112 | ✗ | bool init_combos(bool validate, zquestheader *Header) | |
| 1113 | { | ||
| 1114 | ✗ | return init_section(Header, ID_COMBOS, NULL, NULL, validate, "modules/classic/default.qst"); | |
| 1115 | } | ||
| 1116 | |||
| 1117 | ✗ | bool init_colordata(bool validate, zquestheader *Header, miscQdata *Misc) | |
| 1118 | { | ||
| 1119 | ✗ | return init_section(Header, ID_CSETS, Misc, NULL, validate, "modules/classic/default.qst"); | |
| 1120 | } | ||
| 1121 | |||
| 1122 | 690 | void init_spritelists() | |
| 1123 | { | ||
| 1124 |
2/2✓ Branch 0 taken 547 times.
✓ Branch 1 taken 143 times.
|
690 | if(FFCore.quest_format[vZelda] < 0x255) |
| 1125 | { | ||
| 1126 | 547 | guys.setMax(255); | |
| 1127 | 547 | items.setMax(255); | |
| 1128 | 547 | Ewpns.setMax(255); | |
| 1129 | 547 | Lwpns.setMax(255); | |
| 1130 | 547 | chainlinks.setMax(255); | |
| 1131 | 547 | decorations.setMax(255); | |
| 1132 | 547 | particles.setMax(255); | |
| 1133 | 547 | } | |
| 1134 | else | ||
| 1135 | { | ||
| 1136 | 143 | guys.setMax(255); | |
| 1137 | 143 | items.setMax(255); | |
| 1138 | 143 | Ewpns.setMax(255); | |
| 1139 | 143 | Lwpns.setMax(255); | |
| 1140 | 143 | chainlinks.setMax(255); | |
| 1141 | 143 | decorations.setMax(255); | |
| 1142 | 143 | particles.setMax(255*((255*4)+1)); //255 per sprite that can use particles; guys, items, ewpns, lwpns, +HERO | |
| 1143 | } | ||
| 1144 | 690 | } | |
| 1145 | |||
| 1146 | 267 | bool reset_items(bool validate, zquestheader *Header) | |
| 1147 | { | ||
| 1148 | 267 | bool ret = true; | |
| 1149 |
1/2✓ Branch 0 taken 267 times.
✗ Branch 1 not taken.
|
267 | if (get_app_id() == App::zquest) |
| 1150 | ✗ | ret = init_section(Header, ID_ITEMS, NULL, NULL, validate, "modules/classic/default.qst"); | |
| 1151 | |||
| 1152 |
2/2✓ Branch 0 taken 267 times.
✓ Branch 1 taken 68352 times.
|
68619 | for(int32_t i=0; i<MAXITEMS; i++) reset_itemname(i); |
| 1153 | |||
| 1154 | 267 | return ret; | |
| 1155 | } | ||
| 1156 | |||
| 1157 | ✗ | bool reset_guys() | |
| 1158 | { | ||
| 1159 | // The .dat file's guys definitions are always synchronised with defdata.cpp's - even the tile settings. | ||
| 1160 | ✗ | init_guys(V_GUYS); | |
| 1161 | ✗ | return true; | |
| 1162 | } | ||
| 1163 | |||
| 1164 | ✗ | bool reset_wpns(bool validate, zquestheader *Header) | |
| 1165 | { | ||
| 1166 | ✗ | bool ret = true; | |
| 1167 | ✗ | if (get_app_id() == App::zquest) | |
| 1168 | ✗ | ret = init_section(Header, ID_WEAPONS, NULL, NULL, validate, "modules/classic/default.qst"); | |
| 1169 | |||
| 1170 | ✗ | for(int32_t i=0; i<MAXWPNS; i++) | |
| 1171 | ✗ | reset_weaponname(i); | |
| 1172 | |||
| 1173 | ✗ | return ret; | |
| 1174 | } | ||
| 1175 | |||
| 1176 | ✗ | bool reset_mapstyles(bool validate, miscQdata *Misc) | |
| 1177 | { | ||
| 1178 | ✗ | Misc->colors.blueframe_tile = 20044; | |
| 1179 | ✗ | Misc->colors.blueframe_cset = 0; | |
| 1180 | ✗ | Misc->colors.triforce_tile = 23461; | |
| 1181 | ✗ | Misc->colors.triforce_cset = 1; | |
| 1182 | ✗ | Misc->colors.triframe_tile = 18752; | |
| 1183 | ✗ | Misc->colors.triframe_cset = 1; | |
| 1184 | ✗ | Misc->colors.overworld_map_tile = 16990; | |
| 1185 | ✗ | Misc->colors.overworld_map_cset = 2; | |
| 1186 | ✗ | Misc->colors.HCpieces_tile = 21160; | |
| 1187 | ✗ | Misc->colors.HCpieces_cset = 8; | |
| 1188 | ✗ | Misc->colors.dungeon_map_tile = 19651; | |
| 1189 | ✗ | Misc->colors.dungeon_map_cset = 8; | |
| 1190 | ✗ | return true; | |
| 1191 | } | ||
| 1192 | |||
| 1193 | 315 | int32_t get_qst_buffers() | |
| 1194 | { | ||
| 1195 | 315 | TheMaps.resize(MAPSCRS); | |
| 1196 | 315 | old_combo_pages.resize(MAPSCRS); | |
| 1197 | 315 | map_autolayers.resize(6); | |
| 1198 | |||
| 1199 | 315 | Z_message("OK\n"); | |
| 1200 | |||
| 1201 | // The vast majority of finished quests (and I presume this will be consistent for all time) use < 1000 strings in total. | ||
| 1202 | // (Shoelace's "Hero of Dreams" uses 1415.) | ||
| 1203 | // So let's be a bit generous and allow 4096 initially. | ||
| 1204 | // In the rare event that a quest overshoots this mark, we'll reallocate to the full 65535 later. | ||
| 1205 | // I tested it and it worked without flaw on 6/6/11. - L. | ||
| 1206 | // 2022: bumped from 4096 to 8192 to avoid a bug where the Strings menu shows (None) strings when the list passes | ||
| 1207 | // this threshold. Possibly some bug related to `msglistcache` to being reset? | ||
| 1208 | // See https://discord.com/channels/876899628556091432/992984989073416242 | ||
| 1209 | 315 | msg_strings_size = 8192; | |
| 1210 | |||
| 1211 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 315 times.
|
315 | MsgStrings = new MsgStr[msg_strings_size]; |
| 1212 | |||
| 1213 | //memset(MsgStrings, 0, sizeof(MsgStr)*msg_strings_size); | ||
| 1214 |
2/2✓ Branch 0 taken 2580480 times.
✓ Branch 1 taken 315 times.
|
2580795 | for(auto q = 0; q < msg_strings_size; ++q) |
| 1215 | { | ||
| 1216 | 2580480 | MsgStrings[q].clear(); | |
| 1217 | 2580480 | } | |
| 1218 | |||
| 1219 | |||
| 1220 |
1/2✓ Branch 0 taken 315 times.
✗ Branch 1 not taken.
|
315 | if((DoorComboSets=(DoorComboSet*)malloc(sizeof(DoorComboSet)*MAXDOORCOMBOSETS))==NULL) |
| 1221 | ✗ | return 0; | |
| 1222 | |||
| 1223 | |||
| 1224 | |||
| 1225 |
1/2✓ Branch 0 taken 315 times.
✗ Branch 1 not taken.
|
315 | if((DMaps=new dmap[MAXDMAPS])==NULL) |
| 1226 | ✗ | return 0; | |
| 1227 | |||
| 1228 | |||
| 1229 | |||
| 1230 | 315 | combobuf.clear(); | |
| 1231 | 315 | combobuf.resize(MAXCOMBOS); | |
| 1232 | |||
| 1233 | |||
| 1234 |
1/2✓ Branch 0 taken 315 times.
✗ Branch 1 not taken.
|
315 | if((colordata=(byte*)malloc(psTOTAL255))==NULL) |
| 1235 | ✗ | return 0; | |
| 1236 | |||
| 1237 | 315 | free_newtilebuf(); | |
| 1238 |
1/2✓ Branch 0 taken 315 times.
✗ Branch 1 not taken.
|
315 | if((newtilebuf=(tiledata*)malloc(NEWMAXTILES*sizeof(tiledata)))==NULL) |
| 1239 | ✗ | return 0; | |
| 1240 | |||
| 1241 | 315 | memset(newtilebuf, 0, NEWMAXTILES*sizeof(tiledata)); | |
| 1242 | //Z_message("Performed memset on tiles\n"); | ||
| 1243 | 315 | clear_tiles(newtilebuf); | |
| 1244 | //Z_message("Performed clear_tiles()\n"); | ||
| 1245 | |||
| 1246 |
2/2✓ Branch 0 taken 305 times.
✓ Branch 1 taken 10 times.
|
315 | if (get_app_id() == App::zquest) |
| 1247 | { | ||
| 1248 |
1/2✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
|
10 | if((grabtilebuf=(tiledata*)malloc(NEWMAXTILES*sizeof(tiledata)))==NULL) |
| 1249 | ✗ | return 0; | |
| 1250 | |||
| 1251 | 10 | memset(grabtilebuf, 0, NEWMAXTILES*sizeof(tiledata)); | |
| 1252 | 10 | clear_tiles(grabtilebuf); | |
| 1253 | 10 | } | |
| 1254 | |||
| 1255 |
1/2✓ Branch 0 taken 315 times.
✗ Branch 1 not taken.
|
315 | if((trashbuf=(byte*)malloc(100000))==NULL) |
| 1256 | ✗ | return 0; | |
| 1257 | |||
| 1258 | // Big, ugly band-aid here. Perhaps the most common cause of random crashes | ||
| 1259 | // has been inadvertently accessing itemsbuf[-1]. All such crashes should be | ||
| 1260 | // fixed by ensuring there's actually itemdata there. | ||
| 1261 | // If you change this, be sure to update del_qst_buffers, too. | ||
| 1262 | |||
| 1263 |
1/2✓ Branch 0 taken 315 times.
✗ Branch 1 not taken.
|
315 | if((itemsbuf=(itemdata*)malloc(sizeof(itemdata)*(MAXITEMS+1)))==NULL) |
| 1264 | ✗ | return 0; | |
| 1265 | |||
| 1266 | 315 | memset(itemsbuf,0,sizeof(itemdata)*(MAXITEMS+1)); | |
| 1267 | 315 | itemsbuf++; | |
| 1268 | |||
| 1269 |
1/2✓ Branch 0 taken 315 times.
✗ Branch 1 not taken.
|
315 | if((wpnsbuf=(wpndata*)malloc(sizeof(wpndata)*MAXWPNS))==NULL) |
| 1270 | ✗ | return 0; | |
| 1271 | |||
| 1272 | 315 | memset(wpnsbuf,0,sizeof(wpndata)*MAXWPNS); | |
| 1273 | |||
| 1274 |
1/2✓ Branch 0 taken 315 times.
✗ Branch 1 not taken.
|
315 | if((guysbuf=(guydata*)malloc(sizeof(guydata)*MAXGUYS))==NULL) |
| 1275 | ✗ | return 0; | |
| 1276 | |||
| 1277 | 315 | memset(guysbuf,0,sizeof(guydata)*MAXGUYS); | |
| 1278 | |||
| 1279 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 315 times.
|
315 | if((combo_class_buf=(comboclass*)malloc(sizeof(comboclass)*cMAX))==NULL) |
| 1280 | ✗ | return 0; | |
| 1281 | |||
| 1282 | 315 | return 1; | |
| 1283 | 315 | } | |
| 1284 | |||
| 1285 | |||
| 1286 | 591 | void free_newtilebuf() | |
| 1287 | { | ||
| 1288 |
2/2✓ Branch 0 taken 277 times.
✓ Branch 1 taken 314 times.
|
591 | if(newtilebuf) |
| 1289 | { | ||
| 1290 |
2/2✓ Branch 0 taken 59416500 times.
✓ Branch 1 taken 277 times.
|
59416777 | for(int32_t i=0; i<NEWMAXTILES; i++) |
| 1291 |
2/2✓ Branch 0 taken 214500 times.
✓ Branch 1 taken 59202000 times.
|
118618500 | if(newtilebuf[i].data) |
| 1292 | 59202000 | free(newtilebuf[i].data); | |
| 1293 | |||
| 1294 | 277 | free(newtilebuf); | |
| 1295 | 277 | newtilebuf = 0; | |
| 1296 | 277 | } | |
| 1297 | 591 | } | |
| 1298 | |||
| 1299 | 276 | void free_grabtilebuf() | |
| 1300 | { | ||
| 1301 |
2/2✓ Branch 0 taken 267 times.
✓ Branch 1 taken 9 times.
|
276 | if (get_app_id() == App::zquest) |
| 1302 | { | ||
| 1303 |
1/2✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
|
9 | if(grabtilebuf) |
| 1304 | { | ||
| 1305 |
2/2✓ Branch 0 taken 1930500 times.
✓ Branch 1 taken 9 times.
|
1930509 | for(int32_t i=0; i<NEWMAXTILES; i++) |
| 1306 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1930500 times.
|
1930500 | if(grabtilebuf[i].data) free(grabtilebuf[i].data); |
| 1307 | |||
| 1308 | 9 | free(grabtilebuf); | |
| 1309 | 9 | grabtilebuf = 0; | |
| 1310 | 9 | } | |
| 1311 | 9 | } | |
| 1312 | 276 | } | |
| 1313 | |||
| 1314 | 276 | void del_qst_buffers() | |
| 1315 | { | ||
| 1316 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 276 times.
✓ Branch 2 taken 276 times.
✗ Branch 3 not taken.
|
276 | if(MsgStrings) delete[] MsgStrings; |
| 1317 | |||
| 1318 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 276 times.
|
276 | if(DoorComboSets) free(DoorComboSets); |
| 1319 | |||
| 1320 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 276 times.
✓ Branch 2 taken 276 times.
✗ Branch 3 not taken.
|
276 | if (DMaps) delete[] DMaps; |
| 1321 | |||
| 1322 | 276 | combobuf.clear(); | |
| 1323 | |||
| 1324 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 276 times.
|
276 | if(colordata) free(colordata); |
| 1325 | |||
| 1326 | 276 | free_newtilebuf(); | |
| 1327 | 276 | free_grabtilebuf(); | |
| 1328 | |||
| 1329 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 276 times.
|
276 | if(trashbuf) free(trashbuf); |
| 1330 | |||
| 1331 | // See get_qst_buffers | ||
| 1332 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 276 times.
|
276 | if(itemsbuf) |
| 1333 | { | ||
| 1334 | 276 | itemsbuf--; | |
| 1335 | 276 | free(itemsbuf); | |
| 1336 | 276 | } | |
| 1337 | |||
| 1338 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 276 times.
|
276 | if(wpnsbuf) free(wpnsbuf); |
| 1339 | |||
| 1340 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 276 times.
|
276 | if(guysbuf) free(guysbuf); |
| 1341 | |||
| 1342 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 276 times.
|
276 | if(combo_class_buf) free(combo_class_buf); |
| 1343 | 276 | } | |
| 1344 | |||
| 1345 | 18 | bool init_palnames() | |
| 1346 | { | ||
| 1347 | // if(palnames==NULL) | ||
| 1348 | // return false; | ||
| 1349 | |||
| 1350 |
2/2✓ Branch 0 taken 9216 times.
✓ Branch 1 taken 18 times.
|
9234 | for(int32_t x=0; x<MAXLEVELS; x++) |
| 1351 | { | ||
| 1352 |
4/4✓ Branch 0 taken 9162 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 18 times.
✓ Branch 3 taken 18 times.
|
9216 | switch(x) |
| 1353 | { | ||
| 1354 | case 0: | ||
| 1355 | 18 | sprintf(palnames[x],"Overworld"); | |
| 1356 | 18 | break; | |
| 1357 | |||
| 1358 | case 10: | ||
| 1359 | 18 | sprintf(palnames[x],"Caves"); | |
| 1360 | 18 | break; | |
| 1361 | |||
| 1362 | case 11: | ||
| 1363 | 18 | sprintf(palnames[x],"Passageways"); | |
| 1364 | 18 | break; | |
| 1365 | |||
| 1366 | default: | ||
| 1367 | 9162 | sprintf(palnames[x],"%c",0); | |
| 1368 | 9162 | break; | |
| 1369 | } | ||
| 1370 | 9216 | } | |
| 1371 | |||
| 1372 | 18 | return true; | |
| 1373 | } | ||
| 1374 | |||
| 1375 | 97243 | static void *read_block(PACKFILE *f, int32_t size, int32_t alloc_size) | |
| 1376 | { | ||
| 1377 | void *p; | ||
| 1378 | |||
| 1379 |
1/2✓ Branch 0 taken 97243 times.
✗ Branch 1 not taken.
|
97243 | p = _AL_MALLOC(MAX(size, alloc_size)); |
| 1380 | |||
| 1381 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 97243 times.
|
97243 | if(!p) |
| 1382 | { | ||
| 1383 | ✗ | return NULL; | |
| 1384 | } | ||
| 1385 | |||
| 1386 |
1/2✓ Branch 0 taken 97243 times.
✗ Branch 1 not taken.
|
97243 | if(!pfread(p,size,f)) |
| 1387 | { | ||
| 1388 | ✗ | _AL_FREE(p); | |
| 1389 | ✗ | return NULL; | |
| 1390 | } | ||
| 1391 | |||
| 1392 |
1/2✓ Branch 0 taken 97243 times.
✗ Branch 1 not taken.
|
97243 | if(pack_ferror(f)) |
| 1393 | { | ||
| 1394 | ✗ | _AL_FREE(p); | |
| 1395 | ✗ | return NULL; | |
| 1396 | } | ||
| 1397 | |||
| 1398 | 97243 | return p; | |
| 1399 | 97243 | } | |
| 1400 | |||
| 1401 | // Only use for reading parts of older quests (Header->zelda_version <= 0x192) | ||
| 1402 | static const byte* legacy_skip_flags; | ||
| 1403 | |||
| 1404 | /* read_midi: | ||
| 1405 | * Reads MIDI data from a datafile (this is not the same thing as the | ||
| 1406 | * standard midi file format). | ||
| 1407 | */ | ||
| 1408 | |||
| 1409 | 9963 | static MIDI *read_midi(PACKFILE *f) | |
| 1410 | { | ||
| 1411 | MIDI *m; | ||
| 1412 | int32_t c; | ||
| 1413 | 9963 | int16_t divisions=0; | |
| 1414 | 9963 | int32_t len=0; | |
| 1415 | |||
| 1416 | 9963 | m = (MIDI*)_AL_MALLOC(sizeof(MIDI)); | |
| 1417 | |||
| 1418 |
1/2✓ Branch 0 taken 9963 times.
✗ Branch 1 not taken.
|
9963 | if(!m) |
| 1419 | { | ||
| 1420 | ✗ | return NULL; | |
| 1421 | } | ||
| 1422 | |||
| 1423 |
2/2✓ Branch 0 taken 318816 times.
✓ Branch 1 taken 9963 times.
|
328779 | for(c=0; c<MIDI_TRACKS; c++) |
| 1424 | { | ||
| 1425 | 318816 | m->track[c].len = 0; | |
| 1426 | 318816 | m->track[c].data = NULL; | |
| 1427 | 318816 | } | |
| 1428 | |||
| 1429 | 9963 | p_mgetw(&divisions,f); | |
| 1430 | 9963 | m->divisions=divisions; | |
| 1431 | |||
| 1432 |
2/2✓ Branch 0 taken 318816 times.
✓ Branch 1 taken 9963 times.
|
328779 | for(c=0; c<MIDI_TRACKS; c++) |
| 1433 | { | ||
| 1434 | 318816 | p_mgetl(&len,f); | |
| 1435 | 318816 | m->track[c].len=len; | |
| 1436 | |||
| 1437 |
2/2✓ Branch 0 taken 221573 times.
✓ Branch 1 taken 97243 times.
|
318816 | if(m->track[c].len > 0) |
| 1438 | { | ||
| 1439 | 97243 | m->track[c].data = (byte*)read_block(f, m->track[c].len, 0); | |
| 1440 | |||
| 1441 |
1/2✓ Branch 0 taken 97243 times.
✗ Branch 1 not taken.
|
97243 | if(!m->track[c].data) |
| 1442 | { | ||
| 1443 | ✗ | destroy_midi(m); | |
| 1444 | ✗ | return NULL; | |
| 1445 | } | ||
| 1446 | 97243 | } | |
| 1447 | 318816 | } | |
| 1448 | |||
| 1449 | LOCK_DATA(m, sizeof(MIDI)); | ||
| 1450 | |||
| 1451 |
2/2✓ Branch 0 taken 318816 times.
✓ Branch 1 taken 9963 times.
|
328779 | for(c=0; c<MIDI_TRACKS; c++) |
| 1452 | { | ||
| 1453 |
2/2✓ Branch 0 taken 97243 times.
✓ Branch 1 taken 221573 times.
|
318816 | if(m->track[c].data) |
| 1454 | { | ||
| 1455 | LOCK_DATA(m->track[c].data, m->track[c].len); | ||
| 1456 | 97243 | } | |
| 1457 | 318816 | } | |
| 1458 | |||
| 1459 | 9963 | return m; | |
| 1460 | 9963 | } | |
| 1461 | |||
| 1462 | ✗ | void clear_combo(int32_t i) | |
| 1463 | { | ||
| 1464 | ✗ | combobuf[i].clear(); | |
| 1465 | ✗ | } | |
| 1466 | |||
| 1467 | ✗ | void clear_combos() | |
| 1468 | { | ||
| 1469 | ✗ | for(int32_t tmpcounter=0; tmpcounter<MAXCOMBOS; tmpcounter++) | |
| 1470 | ✗ | clear_combo(tmpcounter); | |
| 1471 | ✗ | } | |
| 1472 | |||
| 1473 | ✗ | void pack_combos() | |
| 1474 | { | ||
| 1475 | ✗ | int32_t di = 0; | |
| 1476 | |||
| 1477 | ✗ | for(int32_t si=0; si<1024; si+=2) | |
| 1478 | ✗ | combobuf[di++] = combobuf[si]; | |
| 1479 | |||
| 1480 | ✗ | for(; di<1024; di++) | |
| 1481 | ✗ | clear_combo(di); | |
| 1482 | ✗ | } | |
| 1483 | |||
| 1484 | 414 | void reset_tunes(zctune *tune) | |
| 1485 | { | ||
| 1486 |
2/2✓ Branch 0 taken 104328 times.
✓ Branch 1 taken 414 times.
|
104742 | for(int32_t i=0; i<MAXCUSTOMTUNES; i++) |
| 1487 | { | ||
| 1488 | 104328 | tune[i].reset(); | |
| 1489 | 104328 | } | |
| 1490 | 414 | } | |
| 1491 | |||
| 1492 | |||
| 1493 | /*void reset_midi(zcmidi_ *m) | ||
| 1494 | { | ||
| 1495 | m->title[0]=0; | ||
| 1496 | m->loop=1; | ||
| 1497 | m->volume=144; | ||
| 1498 | m->start=0; | ||
| 1499 | m->loop_start=-1; | ||
| 1500 | m->loop_end=-1; | ||
| 1501 | if(m->midi) | ||
| 1502 | { | ||
| 1503 | destroy_midi(m->midi); | ||
| 1504 | } | ||
| 1505 | m->midi=NULL; | ||
| 1506 | } | ||
| 1507 | |||
| 1508 | |||
| 1509 | void reset_midis(zcmidi_ *m) | ||
| 1510 | { | ||
| 1511 | for(int32_t i=0; i<MAXCUSTOMMIDIS; i++) | ||
| 1512 | { | ||
| 1513 | reset_midi(m+i); | ||
| 1514 | } | ||
| 1515 | } | ||
| 1516 | */ | ||
| 1517 | |||
| 1518 | ✗ | void reset_scr(int32_t scr) | |
| 1519 | { | ||
| 1520 | /* | ||
| 1521 | byte *di=((byte*)TheMaps)+(scr*sizeof(mapscr)); | ||
| 1522 | for(unsigned i=0; i<sizeof(mapscr); i++) | ||
| 1523 | *(di++) = 0; | ||
| 1524 | TheMaps[scr].valid=mVERSION; | ||
| 1525 | */ | ||
| 1526 | |||
| 1527 | ✗ | TheMaps[scr].zero_memory(); | |
| 1528 | //byte *di=((byte*)TheMaps)+(scr*sizeof(mapscr)); | ||
| 1529 | |||
| 1530 | ✗ | for(int32_t i=0; i<6; i++) | |
| 1531 | { | ||
| 1532 | //these will be uncommented later | ||
| 1533 | //TheMaps[scr].layerxsize[i]=16; | ||
| 1534 | //TheMaps[scr].layerysize[i]=11; | ||
| 1535 | ✗ | TheMaps[scr].layeropacity[i]=255; | |
| 1536 | ✗ | } | |
| 1537 | |||
| 1538 | ✗ | TheMaps[scr].valid=mVERSION; | |
| 1539 | |||
| 1540 | ✗ | } | |
| 1541 | |||
| 1542 | /* For reference: | ||
| 1543 | |||
| 1544 | enum { qe_OK, qe_notfound, qe_invalid, qe_version, qe_obsolete, | ||
| 1545 | qe_missing, qe_internal, qe_pwd, qe_match, qe_minver }; | ||
| 1546 | */ | ||
| 1547 | |||
| 1548 | 10306 | int32_t operator ==(DoorComboSet a, DoorComboSet b) | |
| 1549 | { | ||
| 1550 |
2/2✓ Branch 0 taken 45226 times.
✓ Branch 1 taken 4365 times.
|
49591 | for(int32_t i=0; i<9; i++) |
| 1551 | { | ||
| 1552 |
2/2✓ Branch 0 taken 245821 times.
✓ Branch 1 taken 40119 times.
|
285940 | for(int32_t j=0; j<6; j++) |
| 1553 | { | ||
| 1554 |
2/2✓ Branch 0 taken 80238 times.
✓ Branch 1 taken 165583 times.
|
245821 | if(j<4) |
| 1555 | { | ||
| 1556 |
2/2✓ Branch 0 taken 160476 times.
✓ Branch 1 taken 5107 times.
|
165583 | if(a.doorcombo_u[i][j]!=b.doorcombo_u[i][j]) |
| 1557 | { | ||
| 1558 | 5107 | return false; | |
| 1559 | } | ||
| 1560 | |||
| 1561 |
1/2✓ Branch 0 taken 160476 times.
✗ Branch 1 not taken.
|
160476 | if(a.doorcset_u[i][j]!=b.doorcset_u[i][j]) |
| 1562 | { | ||
| 1563 | ✗ | return false; | |
| 1564 | } | ||
| 1565 | |||
| 1566 |
1/2✓ Branch 0 taken 160476 times.
✗ Branch 1 not taken.
|
160476 | if(a.doorcombo_d[i][j]!=b.doorcombo_d[i][j]) |
| 1567 | { | ||
| 1568 | ✗ | return false; | |
| 1569 | } | ||
| 1570 | |||
| 1571 |
1/2✓ Branch 0 taken 160476 times.
✗ Branch 1 not taken.
|
160476 | if(a.doorcset_d[i][j]!=b.doorcset_d[i][j]) |
| 1572 | { | ||
| 1573 | ✗ | return false; | |
| 1574 | } | ||
| 1575 | 160476 | } | |
| 1576 | |||
| 1577 |
1/2✓ Branch 0 taken 240714 times.
✗ Branch 1 not taken.
|
240714 | if(a.doorcombo_l[i][j]!=b.doorcombo_l[i][j]) |
| 1578 | { | ||
| 1579 | ✗ | return false; | |
| 1580 | } | ||
| 1581 | |||
| 1582 |
1/2✓ Branch 0 taken 240714 times.
✗ Branch 1 not taken.
|
240714 | if(a.doorcset_l[i][j]!=b.doorcset_l[i][j]) |
| 1583 | { | ||
| 1584 | ✗ | return false; | |
| 1585 | } | ||
| 1586 | |||
| 1587 |
1/2✓ Branch 0 taken 240714 times.
✗ Branch 1 not taken.
|
240714 | if(a.doorcombo_r[i][j]!=b.doorcombo_r[i][j]) |
| 1588 | { | ||
| 1589 | ✗ | return false; | |
| 1590 | } | ||
| 1591 | |||
| 1592 |
1/2✓ Branch 0 taken 240714 times.
✗ Branch 1 not taken.
|
240714 | if(a.doorcset_r[i][j]!=b.doorcset_r[i][j]) |
| 1593 | { | ||
| 1594 | ✗ | return false; | |
| 1595 | } | ||
| 1596 | 240714 | } | |
| 1597 | |||
| 1598 |
2/2✓ Branch 0 taken 30555 times.
✓ Branch 1 taken 9564 times.
|
40119 | if(i<2) |
| 1599 | { | ||
| 1600 |
1/2✓ Branch 0 taken 9564 times.
✗ Branch 1 not taken.
|
9564 | if(a.flags[i]!=b.flags[i]) |
| 1601 | { | ||
| 1602 | ✗ | return false; | |
| 1603 | } | ||
| 1604 | |||
| 1605 |
2/2✓ Branch 0 taken 9540 times.
✓ Branch 1 taken 24 times.
|
9564 | if(a.bombdoorcombo_u[i]!=b.bombdoorcombo_u[i]) |
| 1606 | { | ||
| 1607 | 24 | return false; | |
| 1608 | } | ||
| 1609 | |||
| 1610 |
1/2✓ Branch 0 taken 9540 times.
✗ Branch 1 not taken.
|
9540 | if(a.bombdoorcset_u[i]!=b.bombdoorcset_u[i]) |
| 1611 | { | ||
| 1612 | ✗ | return false; | |
| 1613 | } | ||
| 1614 | |||
| 1615 |
1/2✓ Branch 0 taken 9540 times.
✗ Branch 1 not taken.
|
9540 | if(a.bombdoorcombo_d[i]!=b.bombdoorcombo_d[i]) |
| 1616 | { | ||
| 1617 | ✗ | return false; | |
| 1618 | } | ||
| 1619 | |||
| 1620 |
1/2✓ Branch 0 taken 9540 times.
✗ Branch 1 not taken.
|
9540 | if(a.bombdoorcset_d[i]!=b.bombdoorcset_d[i]) |
| 1621 | { | ||
| 1622 | ✗ | return false; | |
| 1623 | } | ||
| 1624 | 9540 | } | |
| 1625 | |||
| 1626 |
2/2✓ Branch 0 taken 26190 times.
✓ Branch 1 taken 13905 times.
|
40095 | if(i<3) |
| 1627 | { | ||
| 1628 |
1/2✓ Branch 0 taken 13905 times.
✗ Branch 1 not taken.
|
13905 | if(a.bombdoorcombo_l[i]!=b.bombdoorcombo_l[i]) |
| 1629 | { | ||
| 1630 | ✗ | return false; | |
| 1631 | } | ||
| 1632 | |||
| 1633 |
1/2✓ Branch 0 taken 13905 times.
✗ Branch 1 not taken.
|
13905 | if(a.bombdoorcset_l[i]!=b.bombdoorcset_l[i]) |
| 1634 | { | ||
| 1635 | ✗ | return false; | |
| 1636 | } | ||
| 1637 | |||
| 1638 |
1/2✓ Branch 0 taken 13905 times.
✗ Branch 1 not taken.
|
13905 | if(a.bombdoorcombo_r[i]!=b.bombdoorcombo_r[i]) |
| 1639 | { | ||
| 1640 | ✗ | return false; | |
| 1641 | } | ||
| 1642 | |||
| 1643 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13905 times.
|
13905 | if(a.bombdoorcset_r[i]!=b.bombdoorcset_r[i]) |
| 1644 | { | ||
| 1645 | ✗ | return false; | |
| 1646 | } | ||
| 1647 | 13905 | } | |
| 1648 | |||
| 1649 |
2/2✓ Branch 0 taken 39285 times.
✓ Branch 1 taken 810 times.
|
40095 | if(a.walkthroughcombo[i]!=b.walkthroughcombo[i]) |
| 1650 | { | ||
| 1651 | 810 | return false; | |
| 1652 | } | ||
| 1653 | |||
| 1654 |
1/2✓ Branch 0 taken 39285 times.
✗ Branch 1 not taken.
|
39285 | if(a.walkthroughcset[i]!=b.walkthroughcset[i]) |
| 1655 | { | ||
| 1656 | ✗ | return false; | |
| 1657 | } | ||
| 1658 | 39285 | } | |
| 1659 | |||
| 1660 | 4365 | return true; | |
| 1661 | 10306 | } | |
| 1662 | |||
| 1663 | int32_t doortranslations_u[9][4]= | ||
| 1664 | { | ||
| 1665 | {37,38,53,54}, | ||
| 1666 | {37,38,39,40}, | ||
| 1667 | {37,38,55,56}, | ||
| 1668 | {37,38,39,40}, | ||
| 1669 | {37,38,53,54}, | ||
| 1670 | {37,38,53,54}, | ||
| 1671 | {37,38,53,54}, | ||
| 1672 | {7,8,23,24}, | ||
| 1673 | {7,8,41,42} | ||
| 1674 | }; | ||
| 1675 | |||
| 1676 | int32_t doortranslations_d[9][4]= | ||
| 1677 | { | ||
| 1678 | {117,118,133,134}, | ||
| 1679 | {135,136,133,134}, | ||
| 1680 | {119,120,133,134}, | ||
| 1681 | {135,136,133,134}, | ||
| 1682 | {117,118,133,134}, | ||
| 1683 | {117,118,133,134}, | ||
| 1684 | {117,118,133,134}, | ||
| 1685 | {151,152,167,168}, | ||
| 1686 | {137,138,167,168}, | ||
| 1687 | }; | ||
| 1688 | |||
| 1689 | //enum {dt_pass=0, dt_lock, dt_shut, dt_boss, dt_olck, dt_osht, dt_obos, dt_wall, dt_bomb, dt_walk, dt_max}; | ||
| 1690 | int32_t doortranslations_l[9][6]= | ||
| 1691 | { | ||
| 1692 | {66,67,82,83,98,99}, | ||
| 1693 | {66,68,82,84,98,100}, | ||
| 1694 | {66,69,82,85,98,101}, | ||
| 1695 | {66,68,82,84,98,100}, | ||
| 1696 | {66,67,82,83,98,99}, | ||
| 1697 | {66,67,82,83,98,99}, | ||
| 1698 | {66,67,82,83,98,99}, | ||
| 1699 | {64,65,80,81,96,97}, | ||
| 1700 | {64,65,80,114,96,97}, | ||
| 1701 | }; | ||
| 1702 | |||
| 1703 | int32_t doortranslations_r[9][6]= | ||
| 1704 | { | ||
| 1705 | |||
| 1706 | {76,77,92,93,108,109}, | ||
| 1707 | {75,77,91,93,107,109}, | ||
| 1708 | {74,77,90,93,106,109}, | ||
| 1709 | {75,77,91,93,107,109}, | ||
| 1710 | {76,77,92,93,108,109}, | ||
| 1711 | {76,77,92,93,108,109}, | ||
| 1712 | {76,77,92,93,108,109}, | ||
| 1713 | {78,79,94,95,110,111}, | ||
| 1714 | {78,79,125,95,110,111}, | ||
| 1715 | }; | ||
| 1716 | |||
| 1717 | 858450 | int32_t tdcmbdat(int32_t map, int32_t scr, int32_t pos) | |
| 1718 | { | ||
| 1719 | 858450 | byte old_cpage = old_combo_pages[map*MAPSCRS+scr]; | |
| 1720 | 858450 | return (TheMaps[map*MAPSCRS+TEMPLATE].data[pos]&0xFF) + (old_cpage<<8); | |
| 1721 | } | ||
| 1722 | |||
| 1723 | 840750 | int32_t tdcmbcset(int32_t map, int32_t scr, int32_t pos) | |
| 1724 | { | ||
| 1725 | //these are here to bypass compiler warnings about unused arguments | ||
| 1726 | 840750 | map=map; | |
| 1727 | 840750 | scr=scr; | |
| 1728 | 840750 | pos=pos; | |
| 1729 | |||
| 1730 | //what does this function do? | ||
| 1731 | // return TheMaps[map*MAPSCRS+TEMPLATE].cset[pos]; | ||
| 1732 | 840750 | return 2; | |
| 1733 | } | ||
| 1734 | |||
| 1735 | 22848 | int32_t MakeDoors(int32_t map, int32_t scr) | |
| 1736 | { | ||
| 1737 |
2/2✓ Branch 0 taken 18423 times.
✓ Branch 1 taken 4425 times.
|
22848 | if(!(TheMaps[map*MAPSCRS+scr].valid&mVALID)) |
| 1738 | { | ||
| 1739 | 18423 | return 0; | |
| 1740 | } | ||
| 1741 | |||
| 1742 | DoorComboSet tempdcs; | ||
| 1743 | 4425 | memset(&tempdcs, 0, sizeof(DoorComboSet)); | |
| 1744 | |||
| 1745 | //up | ||
| 1746 |
2/2✓ Branch 0 taken 39825 times.
✓ Branch 1 taken 4425 times.
|
44250 | for(int32_t i=0; i<9; i++) |
| 1747 | { | ||
| 1748 |
2/2✓ Branch 0 taken 159300 times.
✓ Branch 1 taken 39825 times.
|
199125 | for(int32_t j=0; j<4; j++) |
| 1749 | { | ||
| 1750 | 159300 | tempdcs.doorcombo_u[i][j]=tdcmbdat(map,scr,doortranslations_u[i][j]); | |
| 1751 | 159300 | tempdcs.doorcset_u[i][j]=tdcmbcset(map,scr,doortranslations_u[i][j]); | |
| 1752 | 159300 | } | |
| 1753 | 39825 | } | |
| 1754 | |||
| 1755 | 4425 | tempdcs.bombdoorcombo_u[0]=tdcmbdat(map,scr,57); | |
| 1756 | 4425 | tempdcs.bombdoorcset_u[0]=tdcmbcset(map,scr,57); | |
| 1757 | 4425 | tempdcs.bombdoorcombo_u[1]=tdcmbdat(map,scr,58); | |
| 1758 | 4425 | tempdcs.bombdoorcset_u[1]=tdcmbcset(map,scr,58); | |
| 1759 | 4425 | tempdcs.walkthroughcombo[0]=tdcmbdat(map,scr,34); | |
| 1760 | 4425 | tempdcs.walkthroughcset[0]=tdcmbdat(map,scr,34); | |
| 1761 | |||
| 1762 | //down | ||
| 1763 |
2/2✓ Branch 0 taken 39825 times.
✓ Branch 1 taken 4425 times.
|
44250 | for(int32_t i=0; i<9; i++) |
| 1764 | { | ||
| 1765 |
2/2✓ Branch 0 taken 159300 times.
✓ Branch 1 taken 39825 times.
|
199125 | for(int32_t j=0; j<4; j++) |
| 1766 | { | ||
| 1767 | 159300 | tempdcs.doorcombo_d[i][j]=tdcmbdat(map,scr,doortranslations_d[i][j]); | |
| 1768 | 159300 | tempdcs.doorcset_d[i][j]=tdcmbcset(map,scr,doortranslations_d[i][j]); | |
| 1769 | 159300 | } | |
| 1770 | 39825 | } | |
| 1771 | |||
| 1772 | 4425 | tempdcs.bombdoorcombo_d[0]=tdcmbdat(map,scr,121); | |
| 1773 | |||
| 1774 | 4425 | tempdcs.bombdoorcset_d[0]=tdcmbcset(map,scr,121); | |
| 1775 | 4425 | tempdcs.bombdoorcombo_d[1]=tdcmbdat(map,scr,122); | |
| 1776 | 4425 | tempdcs.bombdoorcset_d[1]=tdcmbcset(map,scr,122); | |
| 1777 | 4425 | tempdcs.walkthroughcombo[1]=tdcmbdat(map,scr,34); | |
| 1778 | 4425 | tempdcs.walkthroughcset[1]=tdcmbdat(map,scr,34); | |
| 1779 | |||
| 1780 | //left | ||
| 1781 | // TheMaps[i*MAPSCRS+j].warpdmap=TheOldMap.warpdmap; | ||
| 1782 |
2/2✓ Branch 0 taken 39825 times.
✓ Branch 1 taken 4425 times.
|
44250 | for(int32_t i=0; i<9; i++) |
| 1783 | { | ||
| 1784 |
2/2✓ Branch 0 taken 238950 times.
✓ Branch 1 taken 39825 times.
|
278775 | for(int32_t j=0; j<6; j++) |
| 1785 | { | ||
| 1786 | 238950 | tempdcs.doorcombo_l[i][j]=tdcmbdat(map,scr,doortranslations_l[i][j]); | |
| 1787 | 238950 | tempdcs.doorcset_l[i][j]=tdcmbcset(map,scr,doortranslations_l[i][j]); | |
| 1788 | 238950 | } | |
| 1789 | 39825 | } | |
| 1790 | |||
| 1791 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4425 times.
|
4425 | for(int32_t j=0; j>6; j++) |
| 1792 | { | ||
| 1793 | ✗ | if((j!=2)&&(j!=3)) | |
| 1794 | { | ||
| 1795 | ✗ | tempdcs.doorcombo_l[dt_bomb][j]=TheMaps[map*MAPSCRS+scr].data[doortranslations_l[dt_bomb][j]]; | |
| 1796 | ✗ | tempdcs.doorcset_l[dt_bomb][j]=TheMaps[map*MAPSCRS+scr].cset[doortranslations_l[dt_bomb][j]]; | |
| 1797 | ✗ | } | |
| 1798 | ✗ | } | |
| 1799 | |||
| 1800 | 4425 | tempdcs.bombdoorcombo_l[0]=0; | |
| 1801 | 4425 | tempdcs.bombdoorcset_l[0]=tdcmbcset(map,scr,115); | |
| 1802 | 4425 | tempdcs.bombdoorcombo_l[1]=tdcmbdat(map,scr,115); | |
| 1803 | 4425 | tempdcs.bombdoorcset_l[1]=tdcmbcset(map,scr,115); | |
| 1804 | 4425 | tempdcs.bombdoorcombo_l[2]=0; | |
| 1805 | 4425 | tempdcs.bombdoorcset_l[2]=tdcmbcset(map,scr,115); | |
| 1806 | 4425 | tempdcs.walkthroughcombo[2]=tdcmbdat(map,scr,34); | |
| 1807 | 4425 | tempdcs.walkthroughcset[2]=tdcmbdat(map,scr,34); | |
| 1808 | |||
| 1809 | //right | ||
| 1810 |
2/2✓ Branch 0 taken 39825 times.
✓ Branch 1 taken 4425 times.
|
44250 | for(int32_t i=0; i<9; i++) |
| 1811 | { | ||
| 1812 |
2/2✓ Branch 0 taken 238950 times.
✓ Branch 1 taken 39825 times.
|
278775 | for(int32_t j=0; j<6; j++) |
| 1813 | { | ||
| 1814 | 238950 | tempdcs.doorcombo_r[i][j]=tdcmbdat(map,scr,doortranslations_r[i][j]); | |
| 1815 | 238950 | tempdcs.doorcset_r[i][j]=tdcmbcset(map,scr,doortranslations_r[i][j]); | |
| 1816 | 238950 | } | |
| 1817 | 39825 | } | |
| 1818 | |||
| 1819 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4425 times.
|
4425 | for(int32_t j=0; j>6; j++) |
| 1820 | { | ||
| 1821 | ✗ | if((j!=2)&&(j!=3)) | |
| 1822 | { | ||
| 1823 | ✗ | tempdcs.doorcombo_r[dt_bomb][j]=TheMaps[map*MAPSCRS+scr].data[doortranslations_r[dt_bomb][j]]; | |
| 1824 | ✗ | tempdcs.doorcset_r[dt_bomb][j]=TheMaps[map*MAPSCRS+scr].cset[doortranslations_r[dt_bomb][j]]; | |
| 1825 | ✗ | } | |
| 1826 | ✗ | } | |
| 1827 | |||
| 1828 | 4425 | tempdcs.bombdoorcombo_r[0]=0; | |
| 1829 | 4425 | tempdcs.bombdoorcset_r[0]=tdcmbcset(map,scr,124); | |
| 1830 | 4425 | tempdcs.bombdoorcombo_r[1]=tdcmbdat(map,scr,124); | |
| 1831 | 4425 | tempdcs.bombdoorcset_r[1]=tdcmbcset(map,scr,124); | |
| 1832 | 4425 | tempdcs.bombdoorcombo_r[2]=0; | |
| 1833 | 4425 | tempdcs.bombdoorcset_r[2]=tdcmbcset(map,scr,124); | |
| 1834 | 4425 | tempdcs.walkthroughcombo[3]=tdcmbdat(map,scr,34); | |
| 1835 | 4425 | tempdcs.walkthroughcset[3]=tdcmbdat(map,scr,34); | |
| 1836 | |||
| 1837 | int32_t k; | ||
| 1838 | |||
| 1839 |
2/2✓ Branch 0 taken 60 times.
✓ Branch 1 taken 10306 times.
|
10366 | for(k=0; k<door_combo_set_count; k++) |
| 1840 | { | ||
| 1841 |
2/2✓ Branch 0 taken 4365 times.
✓ Branch 1 taken 5941 times.
|
10306 | if(DoorComboSets[k]==tempdcs) |
| 1842 | { | ||
| 1843 | 4365 | break; | |
| 1844 | } | ||
| 1845 | 5941 | } | |
| 1846 | |||
| 1847 |
2/2✓ Branch 0 taken 4365 times.
✓ Branch 1 taken 60 times.
|
4425 | if(k==door_combo_set_count) |
| 1848 | { | ||
| 1849 | 60 | DoorComboSets[k]=tempdcs; | |
| 1850 | 60 | sprintf(DoorComboSets[k].name, "Door Combo Set %d", k); | |
| 1851 | 60 | ++door_combo_set_count; | |
| 1852 | 60 | } | |
| 1853 | |||
| 1854 | 4425 | return k; | |
| 1855 | /* | ||
| 1856 | doorcombo_u[9][4]; | ||
| 1857 | doorcset_u[9][4]; | ||
| 1858 | doorcombo_d[9][4]; | ||
| 1859 | doorcset_d[9][4]; | ||
| 1860 | doorcombo_l[9][6]; | ||
| 1861 | doorcset_l[9][6]; | ||
| 1862 | doorcombo_r[9][6]; | ||
| 1863 | doorcset_r[9][6]; | ||
| 1864 | bombdoorcombo_u[2]; | ||
| 1865 | bombdoorcset_u[2]; | ||
| 1866 | bombdoorcombo_d[2]; | ||
| 1867 | bombdoorcset_d[2]; | ||
| 1868 | bombdoorcombo_l[3]; | ||
| 1869 | bombdoorcset_l[3]; | ||
| 1870 | bombdoorcombo_r[3]; | ||
| 1871 | bombdoorcset_r[3]; | ||
| 1872 | walkthroughcombo[4]; | ||
| 1873 | walkthroughcset[4]; | ||
| 1874 | */ | ||
| 1875 | 22848 | } | |
| 1876 | |||
| 1877 | 2924544 | INLINE int32_t tcmbdat2(int32_t map, int32_t scr, int32_t pos) | |
| 1878 | { | ||
| 1879 | 2924544 | byte old_cpage = old_combo_pages[map*MAPSCRS+scr]; | |
| 1880 | 2924544 | return (TheMaps[map*MAPSCRS+TEMPLATE2].data[pos]&0xFF) + (old_cpage<<8); | |
| 1881 | } | ||
| 1882 | |||
| 1883 | 2924544 | INLINE int32_t tcmbcset2(int32_t map, int32_t pos) | |
| 1884 | { | ||
| 1885 | |||
| 1886 | 2924544 | return TheMaps[map*MAPSCRS+TEMPLATE2].cset[pos]; | |
| 1887 | } | ||
| 1888 | |||
| 1889 | 2924544 | INLINE int32_t tcmbflag2(int32_t map, int32_t pos) | |
| 1890 | { | ||
| 1891 | 2924544 | return TheMaps[map*MAPSCRS+TEMPLATE2].sflag[pos]; | |
| 1892 | } | ||
| 1893 | |||
| 1894 | |||
| 1895 | 83 | void get_questpwd(char *encrypted_pwd, int16_t pwdkey, char *pwd) | |
| 1896 | { | ||
| 1897 | char temp_pwd[30]; | ||
| 1898 | 83 | memset(temp_pwd,0,30); | |
| 1899 | |||
| 1900 |
2/2✓ Branch 0 taken 75 times.
✓ Branch 1 taken 8 times.
|
83 | if(pwdkey!=0) |
| 1901 | { | ||
| 1902 | 75 | memcpy(temp_pwd,encrypted_pwd,30); | |
| 1903 | 75 | temp_pwd[29]=0; | |
| 1904 | |||
| 1905 |
2/2✓ Branch 0 taken 2250 times.
✓ Branch 1 taken 75 times.
|
2325 | for(int32_t i=0; i<30; i++) |
| 1906 | { | ||
| 1907 | 2250 | temp_pwd[i] -= pwdkey; | |
| 1908 | 2250 | int32_t t=pwdkey>>15; | |
| 1909 | 2250 | pwdkey = (pwdkey<<1)+t; | |
| 1910 | 2250 | } | |
| 1911 | 75 | } | |
| 1912 | |||
| 1913 | 83 | memcpy(pwd,temp_pwd,30); | |
| 1914 | 83 | } | |
| 1915 | |||
| 1916 | |||
| 1917 | 262 | bool devpwd() | |
| 1918 | { | ||
| 1919 | #ifdef _DEBUG | ||
| 1920 | return true; | ||
| 1921 | #endif | ||
| 1922 | #if DEVLEVEL > 3 | ||
| 1923 | return true; | ||
| 1924 | #endif | ||
| 1925 |
1/2✓ Branch 0 taken 262 times.
✗ Branch 1 not taken.
|
262 | return !strcmp(zc_get_config("dev","pwd","",App::zquest), (char*)clavio) || is_ci(); |
| 1926 | } | ||
| 1927 | ✗ | bool check_questpwd(zquestheader *Header, char *pwd) | |
| 1928 | { | ||
| 1929 | ✗ | if(devpwd()) | |
| 1930 | ✗ | return true; | |
| 1931 | ✗ | if((!strcmp(pwd, (char*)clavio))) | |
| 1932 | ✗ | return true; | |
| 1933 | cvs_MD5Context ctx; | ||
| 1934 | uint8_t md5sum[16]; | ||
| 1935 | |||
| 1936 | ✗ | cvs_MD5Init(&ctx); | |
| 1937 | ✗ | cvs_MD5Update(&ctx, (const uint8_t*)pwd, (unsigned)strlen(pwd)); | |
| 1938 | ✗ | cvs_MD5Final(md5sum, &ctx); | |
| 1939 | |||
| 1940 | ✗ | return (memcmp(Header->pwd_hash,md5sum,16)==0); | |
| 1941 | ✗ | } | |
| 1942 | |||
| 1943 | static char const* key_exts[KEYFILE_NUMTY] = {"key", "zcheat", "zpwd"}; | ||
| 1944 | static bool key_hashed[KEYFILE_NUMTY] = {false, true, false}; | ||
| 1945 | static char const* key_namestr[KEYFILE_NUMTY] = {"Master","Cheat","ZPwd"}; | ||
| 1946 | |||
| 1947 | ✗ | static bool check_keyfile(char const* path, char const* ext, bool hashed, char const* typestr, zquestheader* Header) | |
| 1948 | { | ||
| 1949 | char keyfilename[2048]; | ||
| 1950 | ✗ | replace_extension(keyfilename, path, ext, 2047); | |
| 1951 | ✗ | if(!exists(keyfilename)) | |
| 1952 | ✗ | return false; | |
| 1953 | ✗ | bool ret = false; | |
| 1954 | |||
| 1955 | ✗ | char password[QSTPWD_LEN] = {0}, pwd[32] = {0}; | |
| 1956 | ✗ | PACKFILE *fp = pack_fopen_password(keyfilename, F_READ,""); | |
| 1957 | ✗ | char msg[80] = {0}; | |
| 1958 | ✗ | pfread(msg, 80, fp); | |
| 1959 | ✗ | if(strcmp(msg,"ZQuest Auto-Generated Quest Password Key File. DO NOT EDIT!")) | |
| 1960 | { | ||
| 1961 | ✗ | zprint2("Found %s Key File '%s' (invalid header)\n", typestr, keyfilename); | |
| 1962 | ✗ | pack_fclose(fp); | |
| 1963 | ✗ | return false; | |
| 1964 | } | ||
| 1965 | int16_t ver; | ||
| 1966 | byte bld; | ||
| 1967 | ✗ | p_igetw(&ver, fp); | |
| 1968 | ✗ | p_getc(&bld, fp); | |
| 1969 | ✗ | pfread(password, QSTPWD_LEN, fp, true); | |
| 1970 | ✗ | if(hashed) | |
| 1971 | { | ||
| 1972 | ✗ | char unhashed_pw[QSTPWD_LEN] = {0}; | |
| 1973 | |||
| 1974 | ✗ | char hashmap = 'Z'; | |
| 1975 | ✗ | hashmap += 'Q'; | |
| 1976 | ✗ | hashmap += 'U'; | |
| 1977 | ✗ | hashmap += 'E'; | |
| 1978 | ✗ | hashmap += 'S'; | |
| 1979 | ✗ | hashmap += 'T'; | |
| 1980 | |||
| 1981 | ✗ | for ( int32_t q = 0; q < QSTPWD_LEN; ++q ) | |
| 1982 | ✗ | unhashed_pw[q] = password[q] - hashmap; | |
| 1983 | |||
| 1984 | ✗ | ret = check_questpwd(Header, unhashed_pw); | |
| 1985 | ✗ | } | |
| 1986 | ✗ | else ret = check_questpwd(Header, password); | |
| 1987 | ✗ | pack_fclose(fp); | |
| 1988 | ✗ | zprint2("Found %s Key File '%s' (%s access)\n", | |
| 1989 | ✗ | typestr, keyfilename, ret ? "valid" : "invalid"); | |
| 1990 | ✗ | return ret; | |
| 1991 | ✗ | } | |
| 1992 | |||
| 1993 | ✗ | bool check_keyfiles(char const* path, vector<uint> types, zquestheader* Header) | |
| 1994 | { | ||
| 1995 | ✗ | char exedir[PATH_MAX] = {0}; | |
| 1996 | ✗ | extract_name(path, exedir, FILENAMEALL); | |
| 1997 | ✗ | char const* paths[] = {path, exedir}; | |
| 1998 | ✗ | for(uint keyty : types) | |
| 1999 | { | ||
| 2000 | ✗ | if(keyty >= KEYFILE_NUMTY) | |
| 2001 | ✗ | continue; | |
| 2002 | ✗ | for(char const* p : paths) | |
| 2003 | { | ||
| 2004 | ✗ | if(check_keyfile(p, key_exts[keyty], key_hashed[keyty], key_namestr[keyty], Header)) | |
| 2005 | ✗ | return true; | |
| 2006 | } | ||
| 2007 | } | ||
| 2008 | ✗ | return false; | |
| 2009 | ✗ | } | |
| 2010 | |||
| 2011 | 376 | void print_quest_metadata(zquestheader const& tempheader, char const* path, byte qst_num) | |
| 2012 | { | ||
| 2013 | 376 | zprint2("\n"); | |
| 2014 | 376 | zprint2("[QUEST METADATA]\n"); | |
| 2015 |
2/2✓ Branch 0 taken 367 times.
✓ Branch 1 taken 9 times.
|
376 | if(qst_num < moduledata.max_quest_files) |
| 2016 | 9 | zprint2("Loading module quest %d\n", qst_num+1); | |
| 2017 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 376 times.
|
376 | if(path) zprint2("Loading '%s'\n", path); |
| 2018 | 376 | zprint2("Last saved in version %s\n", tempheader.getVerStr()); | |
| 2019 | |||
| 2020 |
2/2✓ Branch 0 taken 243 times.
✓ Branch 1 taken 133 times.
|
376 | if ( tempheader.made_in_module_name[0] ) zprint2("Created with ZC Module: %s\n\n", tempheader.made_in_module_name); |
| 2021 |
2/2✓ Branch 0 taken 243 times.
✓ Branch 1 taken 133 times.
|
376 | if ( tempheader.new_version_devsig[0] ) zprint2("Developr Signoff by: %s\n", tempheader.new_version_devsig); |
| 2022 |
2/2✓ Branch 0 taken 243 times.
✓ Branch 1 taken 133 times.
|
376 | if ( tempheader.new_version_compilername[0] ) zprint2("Compiled with: %s, (ID: %d)\n", tempheader.new_version_compilername, tempheader.compilerid); |
| 2023 |
2/2✓ Branch 0 taken 243 times.
✓ Branch 1 taken 133 times.
|
376 | if ( tempheader.new_version_compilerversion[0] ) zprint2("Compiler Version: %s, (%d,%d,%d,%d)\n", tempheader.new_version_compilerversion,tempheader.compilerversionnumber_first,tempheader.compilerversionnumber_second,tempheader.compilerversionnumber_third,tempheader.compilerversionnumber_fourth); |
| 2024 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 362 times.
|
376 | if ( tempheader.product_name[0] ) zprint2("Project ID: %s\n", tempheader.product_name); |
| 2025 |
2/2✓ Branch 0 taken 243 times.
✓ Branch 1 taken 133 times.
|
376 | if ( tempheader.new_version_id_date_day ) zprint2("Editor Built at date and time: %d-%d-%d at @ %s %s\n", tempheader.new_version_id_date_day, tempheader.new_version_id_date_month, tempheader.new_version_id_date_year, tempheader.build_timestamp, tempheader.build_timezone); |
| 2026 | 376 | zprint2("\n"); | |
| 2027 | 376 | } | |
| 2028 | |||
| 2029 | 690 | int32_t readheader(PACKFILE *f, zquestheader *Header, byte printmetadata) | |
| 2030 | { | ||
| 2031 | int32_t dummy; | ||
| 2032 | zquestheader tempheader; | ||
| 2033 | char dummybuf[80]; | ||
| 2034 | byte temp_map_count; | ||
| 2035 | byte temp_midi_flags[MIDIFLAGS_SIZE]; | ||
| 2036 | word version; | ||
| 2037 | char temp_pwd[30], temp_pwd2[30]; | ||
| 2038 | int16_t temp_pwdkey; | ||
| 2039 | cvs_MD5Context ctx; | ||
| 2040 | 690 | memset(temp_midi_flags, 0, MIDIFLAGS_SIZE); | |
| 2041 | 690 | memset(&tempheader, 0, sizeof(tempheader)); | |
| 2042 | 690 | memset(FFCore.quest_format, 0, sizeof(FFCore.quest_format)); | |
| 2043 | |||
| 2044 | |||
| 2045 | |||
| 2046 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 690 times.
|
690 | if(!pfread(tempheader.id_str,sizeof(tempheader.id_str),f)) // first read old header |
| 2047 | { | ||
| 2048 | ✗ | Z_message("Unable to read header string\n"); | |
| 2049 | ✗ | return qe_invalid; | |
| 2050 | } | ||
| 2051 | |||
| 2052 | // check header | ||
| 2053 |
2/2✓ Branch 0 taken 666 times.
✓ Branch 1 taken 24 times.
|
690 | if(strcmp(tempheader.id_str,QH_NEWIDSTR)) |
| 2054 | { | ||
| 2055 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if(strcmp(tempheader.id_str,QH_IDSTR)) |
| 2056 | { | ||
| 2057 | ✗ | Z_message("Invalid header string: '%s' (was expecting '%s' or '%s')\n", tempheader.id_str, QH_IDSTR, QH_NEWIDSTR); | |
| 2058 | ✗ | return qe_invalid; | |
| 2059 | } | ||
| 2060 | 24 | } | |
| 2061 | |||
| 2062 | 690 | int32_t templatepath_len=0; | |
| 2063 | |||
| 2064 | 690 | tempheader.external_zinfo = false; | |
| 2065 | 690 | read_zinfo = false; | |
| 2066 |
2/2✓ Branch 0 taken 666 times.
✓ Branch 1 taken 24 times.
|
690 | if(!strcmp(tempheader.id_str,QH_IDSTR)) //pre-1.93 version |
| 2067 | { | ||
| 2068 | byte padding; | ||
| 2069 | |||
| 2070 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&padding,f)) |
| 2071 | { | ||
| 2072 | ✗ | return qe_invalid; | |
| 2073 | } | ||
| 2074 | |||
| 2075 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_igetw(&tempheader.zelda_version,f)) |
| 2076 | { | ||
| 2077 | ✗ | return qe_invalid; | |
| 2078 | } | ||
| 2079 | |||
| 2080 | 24 | FFCore.quest_format[vZelda] = tempheader.zelda_version; | |
| 2081 | |||
| 2082 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if(tempheader.zelda_version > ZELDA_VERSION) |
| 2083 | { | ||
| 2084 | ✗ | return qe_version; | |
| 2085 | } | ||
| 2086 | |||
| 2087 | 24 | FFCore.quest_format[vZelda] = tempheader.zelda_version; | |
| 2088 | |||
| 2089 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if(strcmp(tempheader.id_str,QH_IDSTR)) |
| 2090 | { | ||
| 2091 | ✗ | return qe_invalid; | |
| 2092 | } | ||
| 2093 | |||
| 2094 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if(bad_version(tempheader.zelda_version)) |
| 2095 | { | ||
| 2096 | ✗ | return qe_obsolete; | |
| 2097 | } | ||
| 2098 | |||
| 2099 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_igetw(&tempheader.internal,f)) |
| 2100 | { | ||
| 2101 | ✗ | return qe_invalid; | |
| 2102 | } | ||
| 2103 | |||
| 2104 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&tempheader.quest_number,f)) |
| 2105 | { | ||
| 2106 | ✗ | return qe_invalid; | |
| 2107 | } | ||
| 2108 | |||
| 2109 | 24 | FFCore.quest_format[qQuestNumber] = tempheader.quest_number; | |
| 2110 | |||
| 2111 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!pfread(&quest_rules[0],2,f)) |
| 2112 | { | ||
| 2113 | ✗ | return qe_invalid; | |
| 2114 | } | ||
| 2115 | |||
| 2116 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&temp_map_count,f)) |
| 2117 | { | ||
| 2118 | ✗ | return qe_invalid; | |
| 2119 | } | ||
| 2120 | |||
| 2121 | 24 | FFCore.quest_format[qMapCount] = temp_map_count; | |
| 2122 | |||
| 2123 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&tempheader.old_str_count,f)) |
| 2124 | { | ||
| 2125 | ✗ | return qe_invalid; | |
| 2126 | } | ||
| 2127 | |||
| 2128 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&tempheader.data_flags[ZQ_TILES],f)) |
| 2129 | { | ||
| 2130 | ✗ | return qe_invalid; | |
| 2131 | } | ||
| 2132 | |||
| 2133 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!pfread(temp_midi_flags,4,f)) |
| 2134 | { | ||
| 2135 | ✗ | return qe_invalid; | |
| 2136 | } | ||
| 2137 | |||
| 2138 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&tempheader.data_flags[ZQ_CHEATS2],f)) |
| 2139 | { | ||
| 2140 | ✗ | return qe_invalid; | |
| 2141 | } | ||
| 2142 | |||
| 2143 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!pfread(dummybuf,14,f)) |
| 2144 | { | ||
| 2145 | ✗ | return qe_invalid; | |
| 2146 | } | ||
| 2147 | |||
| 2148 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!pfread(&quest_rules[2],2,f)) |
| 2149 | { | ||
| 2150 | ✗ | return qe_invalid; | |
| 2151 | } | ||
| 2152 | |||
| 2153 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&dummybuf,f)) |
| 2154 | { | ||
| 2155 | ✗ | return qe_invalid; | |
| 2156 | } | ||
| 2157 | |||
| 2158 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!pfread(tempheader.version,9,f)) |
| 2159 | { | ||
| 2160 | ✗ | return qe_invalid; | |
| 2161 | } | ||
| 2162 | |||
| 2163 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!pfread(tempheader.title,sizeof(tempheader.title),f)) |
| 2164 | { | ||
| 2165 | ✗ | return qe_invalid; | |
| 2166 | } | ||
| 2167 | // These fields are expected to end in null bytes! | ||
| 2168 | 24 | tempheader.title[sizeof(tempheader.title)-1] = 0; | |
| 2169 | |||
| 2170 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!pfread(tempheader.author,sizeof(tempheader.author),f)) |
| 2171 | { | ||
| 2172 | ✗ | return qe_invalid; | |
| 2173 | } | ||
| 2174 | 24 | tempheader.author[sizeof(tempheader.author)-1] = 0; | |
| 2175 | |||
| 2176 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&padding,f)) |
| 2177 | { | ||
| 2178 | ✗ | return qe_invalid; | |
| 2179 | } | ||
| 2180 | |||
| 2181 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_igetw(&temp_pwdkey,f)) |
| 2182 | { | ||
| 2183 | ✗ | return qe_invalid; | |
| 2184 | } | ||
| 2185 | |||
| 2186 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!pfread(temp_pwd,30,f)) |
| 2187 | { | ||
| 2188 | ✗ | return qe_invalid; | |
| 2189 | } | ||
| 2190 | |||
| 2191 | 24 | get_questpwd(temp_pwd, temp_pwdkey, temp_pwd2); | |
| 2192 | 24 | cvs_MD5Init(&ctx); | |
| 2193 | 24 | cvs_MD5Update(&ctx, (const uint8_t*)temp_pwd2, (unsigned)strnlen(temp_pwd2, 30)); | |
| 2194 | 24 | cvs_MD5Final(tempheader.pwd_hash, &ctx); | |
| 2195 | |||
| 2196 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if(tempheader.zelda_version < 0x177) // lacks new header stuff... |
| 2197 | { | ||
| 2198 | //memset(tempheader.minver,0,20); // char minver[9], byte build, byte foo[10] | ||
| 2199 | // Not anymore... | ||
| 2200 | ✗ | memset(tempheader.minver,0,17); | |
| 2201 | ✗ | tempheader.build=0; | |
| 2202 | ✗ | tempheader.use_keyfile=0; | |
| 2203 | ✗ | memset(tempheader.old_foo, 0, 9); | |
| 2204 | ✗ | } | |
| 2205 | else | ||
| 2206 | { | ||
| 2207 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!pfread(tempheader.minver,9,f)) |
| 2208 | { | ||
| 2209 | ✗ | return qe_invalid; | |
| 2210 | } | ||
| 2211 | |||
| 2212 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&tempheader.build,f)) |
| 2213 | { | ||
| 2214 | ✗ | return qe_invalid; | |
| 2215 | } | ||
| 2216 | |||
| 2217 | 24 | FFCore.quest_format[vBuild] = tempheader.build; | |
| 2218 | |||
| 2219 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!p_getc(&tempheader.use_keyfile,f)) |
| 2220 | { | ||
| 2221 | ✗ | return qe_invalid; | |
| 2222 | } | ||
| 2223 | |||
| 2224 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(!pfread(dummybuf,9,f)) |
| 2225 | { | ||
| 2226 | ✗ | return qe_invalid; | |
| 2227 | } | ||
| 2228 | } // starting at minver | ||
| 2229 | |||
| 2230 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 18 times.
|
24 | if(tempheader.zelda_version < 0x187) // lacks newer header stuff... |
| 2231 | { | ||
| 2232 | 6 | memset(&quest_rules[4],0,16); // word rules3..rules10 | |
| 2233 | 6 | } | |
| 2234 | else | ||
| 2235 | { | ||
| 2236 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(!pfread(&quest_rules[4],16,f)) // read new header additions |
| 2237 | { | ||
| 2238 | ✗ | return qe_invalid; // starting at rules3 | |
| 2239 | } | ||
| 2240 | |||
| 2241 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 12 times.
|
18 | if(tempheader.zelda_version <= 0x190) |
| 2242 | { | ||
| 2243 | 12 | set_qr(qr_MEANPLACEDTRAPS,0); | |
| 2244 | 12 | } | |
| 2245 | } | ||
| 2246 | 24 | unpack_qrs(); | |
| 2247 | |||
| 2248 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
30 | if((tempheader.zelda_version < 0x192)|| |
| 2249 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | ((tempheader.zelda_version == 0x192)&&(tempheader.build<149))) |
| 2250 | { | ||
| 2251 | 18 | set_qr(qr_BRKNSHLDTILES,(get_qr(qr_BRKBLSHLDS_DEP))); | |
| 2252 | 18 | set_bit(deprecated_rules,qr_BRKBLSHLDS_DEP,(get_qr(qr_BRKBLSHLDS_DEP))); | |
| 2253 | 18 | set_qr(qr_BRKBLSHLDS_DEP,0); | |
| 2254 | 18 | } | |
| 2255 | |||
| 2256 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 6 times.
|
24 | if(tempheader.zelda_version >= 0x192) // lacks newer header stuff... |
| 2257 | { | ||
| 2258 | 6 | byte *mf=temp_midi_flags; | |
| 2259 | |||
| 2260 |
3/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 4 times.
|
6 | if((tempheader.zelda_version == 0x192)&&(tempheader.build<178)) |
| 2261 | { | ||
| 2262 | 4 | mf=(byte*)dummybuf; | |
| 2263 | 4 | } | |
| 2264 | |||
| 2265 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | if(!pfread(mf,32,f)) // read new header additions |
| 2266 | { | ||
| 2267 | ✗ | return qe_invalid; // starting at foo2 | |
| 2268 | } | ||
| 2269 | |||
| 2270 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | if(!pfread(dummybuf,18,f)) // read new header additions |
| 2271 | { | ||
| 2272 | ✗ | return qe_invalid; // starting at foo2 | |
| 2273 | } | ||
| 2274 | 6 | } | |
| 2275 | |||
| 2276 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
30 | if((tempheader.zelda_version < 0x192)|| |
| 2277 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | ((tempheader.zelda_version == 0x192)&&(tempheader.build<145))) |
| 2278 | { | ||
| 2279 | 18 | memset(tempheader.templatepath,0,2048); | |
| 2280 | 18 | } | |
| 2281 | else | ||
| 2282 | { | ||
| 2283 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | if(!pfread(tempheader.templatepath,280,f)) // read templatepath |
| 2284 | { | ||
| 2285 | ✗ | return qe_invalid; | |
| 2286 | } | ||
| 2287 | } | ||
| 2288 | |||
| 2289 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
30 | if((tempheader.zelda_version < 0x192)|| |
| 2290 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | ((tempheader.zelda_version == 0x192)&&(tempheader.build<186))) |
| 2291 | { | ||
| 2292 | 24 | tempheader.use_keyfile=0; | |
| 2293 | 24 | } | |
| 2294 | 24 | } | |
| 2295 | else | ||
| 2296 | { | ||
| 2297 | //section id | ||
| 2298 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!p_mgetl(&dummy,f)) |
| 2299 | { | ||
| 2300 | ✗ | return qe_invalid; | |
| 2301 | } | ||
| 2302 | |||
| 2303 | //section version info | ||
| 2304 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!p_igetw(&version,f)) |
| 2305 | { | ||
| 2306 | ✗ | return qe_invalid; | |
| 2307 | } | ||
| 2308 | |||
| 2309 | 666 | FFCore.quest_format[vHeader] = version; | |
| 2310 | |||
| 2311 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!p_igetw(&dummy,f)) |
| 2312 | { | ||
| 2313 | ✗ | return qe_invalid; | |
| 2314 | } | ||
| 2315 | |||
| 2316 | //section size | ||
| 2317 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!p_igetl(&dummy,f)) |
| 2318 | { | ||
| 2319 | ✗ | return qe_invalid; | |
| 2320 | } | ||
| 2321 | |||
| 2322 | //finally... section data | ||
| 2323 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!p_igetw(&tempheader.zelda_version,f)) |
| 2324 | { | ||
| 2325 | ✗ | return qe_invalid; | |
| 2326 | } | ||
| 2327 | |||
| 2328 | 666 | FFCore.quest_format[vZelda] = tempheader.zelda_version; | |
| 2329 | |||
| 2330 | //do some quick checking... | ||
| 2331 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 666 times.
|
666 | if(tempheader.zelda_version > ZELDA_VERSION) |
| 2332 | { | ||
| 2333 | ✗ | return qe_version; | |
| 2334 | } | ||
| 2335 | |||
| 2336 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 666 times.
|
666 | if(strcmp(tempheader.id_str,QH_NEWIDSTR)) |
| 2337 | { | ||
| 2338 | ✗ | return qe_invalid; | |
| 2339 | } | ||
| 2340 | |||
| 2341 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 666 times.
|
666 | if(bad_version(tempheader.zelda_version)) |
| 2342 | { | ||
| 2343 | ✗ | return qe_obsolete; | |
| 2344 | } | ||
| 2345 | |||
| 2346 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!p_getc(&tempheader.build,f)) |
| 2347 | { | ||
| 2348 | ✗ | return qe_invalid; | |
| 2349 | } | ||
| 2350 | |||
| 2351 | 666 | FFCore.quest_format[vBuild] = tempheader.build; | |
| 2352 | |||
| 2353 |
2/2✓ Branch 0 taken 59 times.
✓ Branch 1 taken 607 times.
|
666 | if(version<3) |
| 2354 | { | ||
| 2355 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if(!pfread(temp_pwd,30,f)) |
| 2356 | { | ||
| 2357 | ✗ | return qe_invalid; | |
| 2358 | } | ||
| 2359 | |||
| 2360 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if(!p_igetw(&temp_pwdkey,f)) |
| 2361 | { | ||
| 2362 | ✗ | return qe_invalid; | |
| 2363 | } | ||
| 2364 | |||
| 2365 | 59 | get_questpwd(temp_pwd, temp_pwdkey, temp_pwd2); | |
| 2366 | 59 | cvs_MD5Init(&ctx); | |
| 2367 | 59 | cvs_MD5Update(&ctx, (const uint8_t*)temp_pwd2, (unsigned)strnlen(temp_pwd2, 30)); | |
| 2368 | 59 | cvs_MD5Final(tempheader.pwd_hash, &ctx); | |
| 2369 | 59 | } | |
| 2370 | else | ||
| 2371 | { | ||
| 2372 |
1/2✓ Branch 0 taken 607 times.
✗ Branch 1 not taken.
|
607 | if(!pfread(tempheader.pwd_hash,sizeof(tempheader.pwd_hash),f)) |
| 2373 | { | ||
| 2374 | ✗ | return qe_invalid; | |
| 2375 | } | ||
| 2376 | } | ||
| 2377 | |||
| 2378 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!p_igetw(&tempheader.internal,f)) |
| 2379 | { | ||
| 2380 | ✗ | return qe_invalid; | |
| 2381 | } | ||
| 2382 | |||
| 2383 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!p_getc(&tempheader.quest_number,f)) |
| 2384 | { | ||
| 2385 | ✗ | return qe_invalid; | |
| 2386 | } | ||
| 2387 | |||
| 2388 | 666 | FFCore.quest_format[qQuestNumber] = tempheader.quest_number; | |
| 2389 | |||
| 2390 | 666 | size_t versz = version < 8 ? 9 : 16; | |
| 2391 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!pfread(tempheader.version,versz,f)) |
| 2392 | { | ||
| 2393 | ✗ | return qe_invalid; | |
| 2394 | } | ||
| 2395 | |||
| 2396 | //FFCore.quest_format[qQuestVersion] = tempheader.version; | ||
| 2397 | //needs to be copied as char[9] or stored as a s.str | ||
| 2398 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!pfread(tempheader.minver,versz,f)) |
| 2399 | { | ||
| 2400 | ✗ | return qe_invalid; | |
| 2401 | } | ||
| 2402 | |||
| 2403 | //FFCore.quest_format[qMinQuestVersion] = tempheader.minver; | ||
| 2404 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!pfread(tempheader.title,sizeof(tempheader.title),f)) |
| 2405 | { | ||
| 2406 | ✗ | return qe_invalid; | |
| 2407 | } | ||
| 2408 | 666 | tempheader.title[sizeof(tempheader.title)-1] = 0; | |
| 2409 | |||
| 2410 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!pfread(tempheader.author,sizeof(tempheader.author),f)) |
| 2411 | { | ||
| 2412 | ✗ | return qe_invalid; | |
| 2413 | } | ||
| 2414 | 666 | tempheader.author[sizeof(tempheader.author)-1] = 0; | |
| 2415 | |||
| 2416 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!p_getc(&tempheader.use_keyfile,f)) |
| 2417 | { | ||
| 2418 | ✗ | return qe_invalid; | |
| 2419 | } | ||
| 2420 | |||
| 2421 | /* | ||
| 2422 | if(!pfread(tempheader.data_flags,sizeof(tempheader.data_flags),f)) | ||
| 2423 | { | ||
| 2424 | return qe_invalid; | ||
| 2425 | } | ||
| 2426 | */ | ||
| 2427 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!p_getc(&tempheader.data_flags[ZQ_TILES],f)) |
| 2428 | { | ||
| 2429 | ✗ | return qe_invalid; | |
| 2430 | } | ||
| 2431 | |||
| 2432 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!pfread(&dummybuf,4,f)) |
| 2433 | { | ||
| 2434 | ✗ | return qe_invalid; | |
| 2435 | } | ||
| 2436 | |||
| 2437 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!p_getc(&tempheader.data_flags[ZQ_CHEATS2],f)) |
| 2438 | { | ||
| 2439 | ✗ | return qe_invalid; | |
| 2440 | } | ||
| 2441 | |||
| 2442 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!pfread(dummybuf,14,f)) |
| 2443 | { | ||
| 2444 | ✗ | return qe_invalid; | |
| 2445 | } | ||
| 2446 | |||
| 2447 | 666 | templatepath_len=sizeof(tempheader.templatepath); | |
| 2448 | |||
| 2449 |
2/2✓ Branch 0 taken 607 times.
✓ Branch 1 taken 59 times.
|
666 | if(version==1) |
| 2450 | { | ||
| 2451 | 59 | templatepath_len=280; | |
| 2452 | 59 | } | |
| 2453 | |||
| 2454 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!pfread(tempheader.templatepath,templatepath_len,f)) |
| 2455 | { | ||
| 2456 | ✗ | return qe_invalid; | |
| 2457 | } | ||
| 2458 | |||
| 2459 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!p_getc(&temp_map_count,f)) |
| 2460 | { | ||
| 2461 | ✗ | return qe_invalid; | |
| 2462 | } | ||
| 2463 | |||
| 2464 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 523 times.
|
666 | if(version>=4) |
| 2465 | { | ||
| 2466 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_igetl(&tempheader.version_major,f)) |
| 2467 | { | ||
| 2468 | ✗ | return qe_invalid; | |
| 2469 | } | ||
| 2470 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_igetl(&tempheader.version_minor,f)) |
| 2471 | { | ||
| 2472 | ✗ | return qe_invalid; | |
| 2473 | } | ||
| 2474 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_igetl(&tempheader.version_patch,f)) |
| 2475 | { | ||
| 2476 | ✗ | return qe_invalid; | |
| 2477 | } | ||
| 2478 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_igetl(&tempheader.new_version_id_fourth,f)) |
| 2479 | { | ||
| 2480 | ✗ | return qe_invalid; | |
| 2481 | } | ||
| 2482 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_igetl(&tempheader.new_version_id_alpha,f)) |
| 2483 | { | ||
| 2484 | ✗ | return qe_invalid; | |
| 2485 | } | ||
| 2486 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_igetl(&tempheader.new_version_id_beta,f)) |
| 2487 | { | ||
| 2488 | ✗ | return qe_invalid; | |
| 2489 | } | ||
| 2490 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_igetl(&tempheader.new_version_id_gamma,f)) |
| 2491 | { | ||
| 2492 | ✗ | return qe_invalid; | |
| 2493 | } | ||
| 2494 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_igetl(&tempheader.new_version_id_release,f)) |
| 2495 | { | ||
| 2496 | ✗ | return qe_invalid; | |
| 2497 | } | ||
| 2498 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_igetw(&tempheader.new_version_id_date_year,f)) |
| 2499 | { | ||
| 2500 | ✗ | return qe_invalid; | |
| 2501 | } | ||
| 2502 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_getc(&tempheader.new_version_id_date_month,f)) |
| 2503 | { | ||
| 2504 | ✗ | return qe_invalid; | |
| 2505 | } | ||
| 2506 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_getc(&tempheader.new_version_id_date_day,f)) |
| 2507 | { | ||
| 2508 | ✗ | return qe_invalid; | |
| 2509 | } | ||
| 2510 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_getc(&tempheader.new_version_id_date_hour,f)) |
| 2511 | { | ||
| 2512 | ✗ | return qe_invalid; | |
| 2513 | } | ||
| 2514 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_getc(&tempheader.new_version_id_date_minute,f)) |
| 2515 | { | ||
| 2516 | ✗ | return qe_invalid; | |
| 2517 | } | ||
| 2518 | |||
| 2519 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!pfread(tempheader.new_version_devsig,256,f)) |
| 2520 | { | ||
| 2521 | ✗ | return qe_invalid; | |
| 2522 | } | ||
| 2523 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!strcmp(tempheader.new_version_devsig, "Venrob")) |
| 2524 | ✗ | strcpy(tempheader.new_version_devsig, "EmilyV99"); | |
| 2525 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!pfread(tempheader.new_version_compilername,256,f)) |
| 2526 | { | ||
| 2527 | ✗ | return qe_invalid; | |
| 2528 | } | ||
| 2529 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!pfread(tempheader.new_version_compilerversion,256,f)) |
| 2530 | { | ||
| 2531 | ✗ | return qe_invalid; | |
| 2532 | } | ||
| 2533 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!pfread(tempheader.product_name,1024,f)) |
| 2534 | { | ||
| 2535 | ✗ | return qe_invalid; | |
| 2536 | } | ||
| 2537 | |||
| 2538 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_getc(&tempheader.compilerid,f)) |
| 2539 | { | ||
| 2540 | ✗ | return qe_invalid; | |
| 2541 | } | ||
| 2542 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_igetl(&tempheader.compilerversionnumber_first,f)) |
| 2543 | { | ||
| 2544 | ✗ | return qe_invalid; | |
| 2545 | } | ||
| 2546 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_igetl(&tempheader.compilerversionnumber_second,f)) |
| 2547 | { | ||
| 2548 | ✗ | return qe_invalid; | |
| 2549 | } | ||
| 2550 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_igetl(&tempheader.compilerversionnumber_third,f)) |
| 2551 | { | ||
| 2552 | ✗ | return qe_invalid; | |
| 2553 | } | ||
| 2554 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_igetl(&tempheader.compilerversionnumber_fourth,f)) |
| 2555 | { | ||
| 2556 | ✗ | return qe_invalid; | |
| 2557 | } | ||
| 2558 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_igetw(&tempheader.developerid,f)) |
| 2559 | { | ||
| 2560 | ✗ | return qe_invalid; | |
| 2561 | } | ||
| 2562 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!pfread(tempheader.made_in_module_name,1024,f)) |
| 2563 | { | ||
| 2564 | ✗ | return qe_invalid; | |
| 2565 | } | ||
| 2566 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!pfread(tempheader.build_datestamp,256,f)) |
| 2567 | { | ||
| 2568 | ✗ | return qe_invalid; | |
| 2569 | } | ||
| 2570 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!pfread(tempheader.build_timestamp,256,f)) |
| 2571 | { | ||
| 2572 | ✗ | return qe_invalid; | |
| 2573 | } | ||
| 2574 | 143 | } | |
| 2575 | else // <4 | ||
| 2576 | { | ||
| 2577 | 523 | tempheader.version_major = 0; | |
| 2578 | 523 | tempheader.version_minor = 0; | |
| 2579 | 523 | tempheader.version_patch = 0; | |
| 2580 | 523 | tempheader.new_version_id_fourth = 0; | |
| 2581 | 523 | tempheader.new_version_id_alpha = 0; | |
| 2582 | 523 | tempheader.new_version_id_beta = 0; | |
| 2583 | 523 | tempheader.new_version_id_gamma = 0; | |
| 2584 | 523 | tempheader.new_version_id_release = 0; | |
| 2585 | 523 | tempheader.new_version_id_date_year = 0; | |
| 2586 | 523 | tempheader.new_version_id_date_month = 0; | |
| 2587 | 523 | tempheader.new_version_id_date_day = 0; | |
| 2588 | 523 | tempheader.new_version_id_date_hour = 0; | |
| 2589 | 523 | tempheader.new_version_id_date_minute = 0; | |
| 2590 | |||
| 2591 | 523 | memset(tempheader.new_version_devsig, 0, 256); | |
| 2592 | 523 | memset(tempheader.new_version_compilername, 0, 256); | |
| 2593 | 523 | memset(tempheader.new_version_compilerversion, 0, 256); | |
| 2594 | 523 | memset(tempheader.product_name, 0, 1024); | |
| 2595 | 523 | strcpy(tempheader.product_name, "ZQuest Classic"); | |
| 2596 | |||
| 2597 | 523 | tempheader.compilerid = 0; | |
| 2598 | 523 | tempheader.compilerversionnumber_first = 0; | |
| 2599 | 523 | tempheader.compilerversionnumber_second = 0; | |
| 2600 | 523 | tempheader.compilerversionnumber_third = 0; | |
| 2601 | 523 | tempheader.compilerversionnumber_fourth = 0; | |
| 2602 | 523 | tempheader.developerid = 0; | |
| 2603 | |||
| 2604 | 523 | memset(tempheader.made_in_module_name, 0, 1024); | |
| 2605 | 523 | memset(tempheader.build_datestamp, 0, 256); | |
| 2606 | 523 | memset(tempheader.build_timestamp, 0, 256); | |
| 2607 | } | ||
| 2608 | |||
| 2609 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 523 times.
|
666 | if ( version >= 5 ) |
| 2610 | { | ||
| 2611 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!pfread(tempheader.build_timezone,6,f)) |
| 2612 | { | ||
| 2613 | ✗ | return qe_invalid; | |
| 2614 | } | ||
| 2615 | 143 | } | |
| 2616 | else // < 5 | ||
| 2617 | { | ||
| 2618 | 523 | memset(tempheader.build_timezone, 0, 6); | |
| 2619 | } | ||
| 2620 |
2/2✓ Branch 0 taken 523 times.
✓ Branch 1 taken 143 times.
|
666 | if ( version >= 6 ) |
| 2621 | { | ||
| 2622 | byte b; | ||
| 2623 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 143 times.
|
143 | if(!p_getc(&b,f)) |
| 2624 | { | ||
| 2625 | ✗ | return qe_invalid; | |
| 2626 | } | ||
| 2627 | 143 | tempheader.external_zinfo = b?true:false; | |
| 2628 | 143 | read_zinfo = true; | |
| 2629 | 143 | } | |
| 2630 | |||
| 2631 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 523 times.
|
666 | if(version >= 7) |
| 2632 | { | ||
| 2633 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_getc(&(tempheader.new_version_is_nightly),f)) |
| 2634 | { | ||
| 2635 | ✗ | return qe_invalid; | |
| 2636 | } | ||
| 2637 | 143 | } | |
| 2638 | else | ||
| 2639 | { | ||
| 2640 | 523 | tempheader.new_version_is_nightly = false; | |
| 2641 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 523 times.
|
523 | if(tempheader.zelda_version < 0x255) |
| 2642 | { | ||
| 2643 |
2/5✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 464 times.
✗ Branch 4 not taken.
|
523 | switch(tempheader.zelda_version) |
| 2644 | { | ||
| 2645 | case 0x254: | ||
| 2646 | ✗ | tempheader.version_major = 2; | |
| 2647 | ✗ | tempheader.version_minor = 54; | |
| 2648 | ✗ | break; | |
| 2649 | case 0x250: | ||
| 2650 |
7/16✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 28 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 24 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 6 times.
✓ Branch 11 taken 356 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 16 times.
✓ Branch 14 taken 19 times.
✓ Branch 15 taken 15 times.
|
464 | switch(tempheader.build) |
| 2651 | { | ||
| 2652 | case 19: | ||
| 2653 | ✗ | tempheader.version_major = 2; | |
| 2654 | ✗ | tempheader.version_minor = 50; | |
| 2655 | ✗ | tempheader.new_version_id_gamma = 1; | |
| 2656 | ✗ | break; | |
| 2657 | case 20: | ||
| 2658 | ✗ | tempheader.version_major = 2; | |
| 2659 | ✗ | tempheader.version_minor = 50; | |
| 2660 | ✗ | tempheader.new_version_id_gamma = 2; | |
| 2661 | ✗ | break; | |
| 2662 | case 21: | ||
| 2663 | ✗ | tempheader.version_major = 2; | |
| 2664 | ✗ | tempheader.version_minor = 50; | |
| 2665 | ✗ | tempheader.new_version_id_gamma = 3; | |
| 2666 | ✗ | break; | |
| 2667 | case 22: | ||
| 2668 | ✗ | tempheader.version_major = 2; | |
| 2669 | ✗ | tempheader.version_minor = 50; | |
| 2670 | ✗ | tempheader.new_version_id_gamma = 4; | |
| 2671 | ✗ | break; | |
| 2672 | case 23: | ||
| 2673 | ✗ | tempheader.version_major = 2; | |
| 2674 | ✗ | tempheader.version_minor = 50; | |
| 2675 | ✗ | tempheader.new_version_id_gamma = 5; | |
| 2676 | ✗ | break; | |
| 2677 | case 24: | ||
| 2678 | 28 | tempheader.version_major = 2; | |
| 2679 | 28 | tempheader.version_minor = 50; | |
| 2680 | 28 | tempheader.new_version_id_release = -1; | |
| 2681 | 28 | break; | |
| 2682 | case 25: | ||
| 2683 | ✗ | tempheader.version_major = 2; | |
| 2684 | ✗ | tempheader.version_minor = 50; | |
| 2685 | ✗ | tempheader.version_patch = 1; | |
| 2686 | ✗ | tempheader.new_version_id_gamma = 1; | |
| 2687 | ✗ | break; | |
| 2688 | case 26: | ||
| 2689 | 24 | tempheader.version_major = 2; | |
| 2690 | 24 | tempheader.version_minor = 50; | |
| 2691 | 24 | tempheader.version_patch = 1; | |
| 2692 | 24 | tempheader.new_version_id_gamma = 2; | |
| 2693 | 24 | break; | |
| 2694 | case 27: | ||
| 2695 | ✗ | tempheader.version_major = 2; | |
| 2696 | ✗ | tempheader.version_minor = 50; | |
| 2697 | ✗ | tempheader.version_patch = 1; | |
| 2698 | ✗ | tempheader.new_version_id_gamma = 3; | |
| 2699 | ✗ | break; | |
| 2700 | case 28: | ||
| 2701 | 6 | tempheader.version_major = 2; | |
| 2702 | 6 | tempheader.version_minor = 50; | |
| 2703 | 6 | tempheader.version_patch = 1; | |
| 2704 | 6 | tempheader.new_version_id_release = -1; | |
| 2705 | 6 | break; | |
| 2706 | case 29: | ||
| 2707 | 356 | tempheader.version_major = 2; | |
| 2708 | 356 | tempheader.version_minor = 50; | |
| 2709 | 356 | tempheader.version_patch = 2; | |
| 2710 | 356 | tempheader.new_version_id_release = -1; | |
| 2711 | 356 | break; | |
| 2712 | case 30: | ||
| 2713 | ✗ | tempheader.version_major = 2; | |
| 2714 | ✗ | tempheader.version_minor = 50; | |
| 2715 | ✗ | tempheader.version_patch = 3; | |
| 2716 | ✗ | tempheader.new_version_id_gamma = 1; | |
| 2717 | ✗ | break; | |
| 2718 | case 31: | ||
| 2719 | 16 | tempheader.version_major = 2; | |
| 2720 | 16 | tempheader.version_minor = 53; | |
| 2721 | 16 | tempheader.new_version_id_gamma = -1; | |
| 2722 | 16 | break; | |
| 2723 | case 32: | ||
| 2724 | 19 | tempheader.version_major = 2; | |
| 2725 | 19 | tempheader.version_minor = 53; | |
| 2726 | 19 | tempheader.new_version_id_release = -1; | |
| 2727 | 19 | break; | |
| 2728 | case 33: | ||
| 2729 | 15 | tempheader.version_major = 2; | |
| 2730 | 15 | tempheader.version_minor = 53; | |
| 2731 | 15 | tempheader.version_patch = 1; | |
| 2732 | 15 | break; | |
| 2733 | } | ||
| 2734 | 464 | break; | |
| 2735 | |||
| 2736 | case 0x211: | ||
| 2737 | ✗ | tempheader.version_major = 2; | |
| 2738 | ✗ | tempheader.version_minor = 11; | |
| 2739 | ✗ | tempheader.new_version_id_beta = tempheader.build; | |
| 2740 | ✗ | break; | |
| 2741 | case 0x210: | ||
| 2742 | 59 | tempheader.version_major = 2; | |
| 2743 | 59 | tempheader.version_minor = 10; | |
| 2744 | 59 | tempheader.new_version_id_beta = tempheader.build; | |
| 2745 | 59 | break; | |
| 2746 | } | ||
| 2747 | 523 | } | |
| 2748 | } | ||
| 2749 | |||
| 2750 |
2/2✓ Branch 0 taken 102 times.
✓ Branch 1 taken 564 times.
|
666 | if (version>=9) |
| 2751 | { | ||
| 2752 | 102 | std::string version_string; | |
| 2753 |
2/4✓ Branch 0 taken 102 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 102 times.
✗ Branch 3 not taken.
|
102 | if(!p_getcstr(&version_string, f)) |
| 2754 | { | ||
| 2755 | ✗ | return qe_invalid; | |
| 2756 | } | ||
| 2757 | |||
| 2758 | 102 | strncpy(tempheader.zelda_version_string, version_string.c_str(), sizeof(tempheader.zelda_version_string)); | |
| 2759 | 102 | snprintf(tempheader.zelda_version_string, sizeof(tempheader.zelda_version_string), "%s", version_string.c_str()); | |
| 2760 |
1/3✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 102 times.
|
102 | } |
| 2761 | else | ||
| 2762 | { | ||
| 2763 | 564 | snprintf(tempheader.zelda_version_string, sizeof(tempheader.zelda_version_string), "%d.%d.%d", tempheader.version_major, tempheader.version_minor, tempheader.version_patch); | |
| 2764 | } | ||
| 2765 | |||
| 2766 |
3/4✓ Branch 0 taken 657 times.
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 657 times.
|
666 | if(printmetadata || __isZQuest) |
| 2767 | { | ||
| 2768 | 9 | print_quest_metadata(tempheader, loading_qst_name, loading_qst_num); | |
| 2769 | 9 | } | |
| 2770 | } | ||
| 2771 | |||
| 2772 | //{ Version Warning | ||
| 2773 | 690 | int32_t vercmp = tempheader.compareVer(); | |
| 2774 | 690 | int32_t astatecmp = compare(int32_t(tempheader.getAlphaState()), getAlphaState()); | |
| 2775 | 690 | int32_t avercmp = compare(tempheader.getAlphaVer(), 0); | |
| 2776 |
4/6✓ Branch 0 taken 690 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 102 times.
✓ Branch 3 taken 588 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 102 times.
|
792 | if(vercmp > 0 || (!vercmp && |
| 2777 |
2/4✓ Branch 0 taken 102 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 102 times.
✗ Branch 3 not taken.
|
102 | (astatecmp > 0 || (!astatecmp && |
| 2778 | 102 | avercmp > 0)))) | |
| 2779 | { | ||
| 2780 | ✗ | bool r = true; | |
| 2781 | ✗ | if(loadquest_report) | |
| 2782 | { | ||
| 2783 | ✗ | enter_sys_pal(); | |
| 2784 | ✗ | AlertDialog("Quest saved in newer version", | |
| 2785 | "This quest was last saved in a newer version of ZQuest." | ||
| 2786 | " Attempting to load this quest may not work correctly; to" | ||
| 2787 | ✗ | " avoid issues, try loading this quest in at least '" + std::string(tempheader.getVerStr()) + "'" | |
| 2788 | "\n\nWould you like to continue loading anyway? (Not recommended)", | ||
| 2789 | ✗ | [&](bool ret,bool) | |
| 2790 | { | ||
| 2791 | ✗ | r = ret; | |
| 2792 | ✗ | }).show(); | |
| 2793 | ✗ | exit_sys_pal(); | |
| 2794 | ✗ | } | |
| 2795 | ✗ | if(!r) | |
| 2796 | ✗ | return qe_silenterr; | |
| 2797 | ✗ | } | |
| 2798 |
1/2✓ Branch 0 taken 690 times.
✗ Branch 1 not taken.
|
690 | else if(tempheader.compareDate() > 0) |
| 2799 | { | ||
| 2800 | ✗ | bool r = true; | |
| 2801 | ✗ | if(loadquest_report) | |
| 2802 | { | ||
| 2803 | ✗ | enter_sys_pal(); | |
| 2804 | ✗ | AlertDialog("Quest saved in newer build", | |
| 2805 | ✗ | fmt::format("This quest was last saved in a newer build of ZQuest, and may have" | |
| 2806 | " issues loading in this build." | ||
| 2807 | "\n{}" | ||
| 2808 | "\n\nWould you like to continue loading anyway?", | ||
| 2809 | ✗ | tempheader.getVerCmpStr()), | |
| 2810 | ✗ | [&](bool ret,bool) | |
| 2811 | { | ||
| 2812 | ✗ | r = ret; | |
| 2813 | ✗ | }).show(); | |
| 2814 | ✗ | exit_sys_pal(); | |
| 2815 | ✗ | } | |
| 2816 | ✗ | if(!r) | |
| 2817 | ✗ | return qe_silenterr; | |
| 2818 | ✗ | } | |
| 2819 | //} | ||
| 2820 | |||
| 2821 | 690 | read_ext_zinfo = tempheader.external_zinfo; | |
| 2822 | |||
| 2823 | 690 | memcpy(Header, &tempheader, sizeof(tempheader)); | |
| 2824 | 690 | map_count=temp_map_count; | |
| 2825 | 690 | memcpy(midi_flags, temp_midi_flags, MIDIFLAGS_SIZE); | |
| 2826 | |||
| 2827 | 690 | unpack_qrs(); | |
| 2828 | |||
| 2829 | 690 | return 0; | |
| 2830 | 690 | } | |
| 2831 | |||
| 2832 | 412 | int32_t readrules(PACKFILE *f, zquestheader *Header) | |
| 2833 | { | ||
| 2834 |
2/2✓ Branch 0 taken 389 times.
✓ Branch 1 taken 23 times.
|
412 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_rules); |
| 2835 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 412 times.
|
412 | if (should_skip) |
| 2836 | ✗ | return 0; | |
| 2837 | |||
| 2838 | int32_t dummy; | ||
| 2839 | zquestheader tempheader; | ||
| 2840 | 412 | word s_version=0; | |
| 2841 | 412 | dword compatrule_version=0; | |
| 2842 | |||
| 2843 | 412 | memcpy(&tempheader, Header, sizeof(tempheader)); | |
| 2844 | |||
| 2845 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 391 times.
|
412 | if(tempheader.zelda_version >= 0x193) |
| 2846 | { | ||
| 2847 | //section version info | ||
| 2848 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | if(!p_igetw(&s_version,f)) |
| 2849 | { | ||
| 2850 | ✗ | return qe_invalid; | |
| 2851 | } | ||
| 2852 | |||
| 2853 | 391 | FFCore.quest_format[vRules] = s_version; | |
| 2854 | |||
| 2855 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | if(!p_igetw(&dummy,f)) |
| 2856 | { | ||
| 2857 | ✗ | return qe_invalid; | |
| 2858 | } | ||
| 2859 | |||
| 2860 |
2/2✓ Branch 0 taken 248 times.
✓ Branch 1 taken 143 times.
|
391 | if(s_version > 16) |
| 2861 | { | ||
| 2862 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_igetl(&compatrule_version,f)) |
| 2863 | { | ||
| 2864 | ✗ | return qe_invalid; | |
| 2865 | } | ||
| 2866 | 143 | } | |
| 2867 | 391 | FFCore.quest_format[vCompatRule] = compatrule_version; | |
| 2868 | |||
| 2869 | //section size | ||
| 2870 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | if(!p_igetl(&dummy,f)) |
| 2871 | { | ||
| 2872 | ✗ | return qe_invalid; | |
| 2873 | } | ||
| 2874 | |||
| 2875 |
2/2✓ Branch 0 taken 248 times.
✓ Branch 1 taken 143 times.
|
391 | if ( s_version < 15 ) |
| 2876 | { | ||
| 2877 | //finally... section data | ||
| 2878 |
1/2✓ Branch 0 taken 248 times.
✗ Branch 1 not taken.
|
248 | if(!pfread(quest_rules,QUESTRULES_SIZE,f)) |
| 2879 | { | ||
| 2880 | ✗ | return qe_invalid; | |
| 2881 | } | ||
| 2882 | 248 | } | |
| 2883 | else | ||
| 2884 | { | ||
| 2885 | |||
| 2886 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!pfread(quest_rules,QUESTRULES_NEW_SIZE,f)) |
| 2887 | { | ||
| 2888 | ✗ | return qe_invalid; | |
| 2889 | } | ||
| 2890 | |||
| 2891 | } | ||
| 2892 | 391 | } | |
| 2893 | |||
| 2894 | //{ bunch of compat stuff | ||
| 2895 | 412 | memcpy(deprecated_rules, quest_rules, QUESTRULES_NEW_SIZE); | |
| 2896 | |||
| 2897 | 412 | unpack_qrs(); | |
| 2898 | |||
| 2899 |
2/2✓ Branch 0 taken 330 times.
✓ Branch 1 taken 82 times.
|
412 | if(s_version<2) |
| 2900 | { | ||
| 2901 | 82 | set_qr(14,0); | |
| 2902 | 82 | set_qr(27,0); | |
| 2903 | 82 | set_qr(28,0); | |
| 2904 | 82 | set_qr(29,0); | |
| 2905 | 82 | set_qr(30,0); | |
| 2906 | 82 | set_qr(32,0); | |
| 2907 | 82 | set_qr(36,0); | |
| 2908 | 82 | set_qr(49,0); | |
| 2909 | 82 | set_qr(50,0); | |
| 2910 | 82 | set_qr(51,0); | |
| 2911 | 82 | set_qr(68,0); | |
| 2912 | 82 | set_qr(75,0); | |
| 2913 | 82 | set_qr(76,0); | |
| 2914 | 82 | set_qr(98,0); | |
| 2915 | 82 | set_qr(110,0); | |
| 2916 | 82 | set_qr(113,0); | |
| 2917 | 82 | set_qr(116,0); | |
| 2918 | 82 | set_qr(102,0); | |
| 2919 | 82 | set_qr(132,0); | |
| 2920 | 82 | } | |
| 2921 | |||
| 2922 | //Now, do any updates... | ||
| 2923 |
5/6✓ Branch 0 taken 332 times.
✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 332 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 2 times.
|
412 | if((tempheader.zelda_version < 0x211)||((tempheader.zelda_version == 0x211)&&(tempheader.build<18))) |
| 2924 | { | ||
| 2925 | 82 | set_qr(qr_SMOOTHVERTICALSCROLLING,1); | |
| 2926 | 82 | set_qr(qr_REPLACEOPENDOORS, 1); | |
| 2927 | 82 | set_qr(qr_OLDLENSORDER, 1); | |
| 2928 | 82 | set_qr(qr_NOFAIRYGUYFIRES, 1); | |
| 2929 | 82 | set_qr(qr_TRIGGERSREPEAT, 1); | |
| 2930 | 82 | } | |
| 2931 | |||
| 2932 |
5/6✓ Branch 0 taken 391 times.
✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 391 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 2 times.
|
416 | if((tempheader.zelda_version < 0x193)||((tempheader.zelda_version == 0x193)&&(tempheader.build<3))) |
| 2933 | { | ||
| 2934 | 23 | set_qr(qr_WALLFLIERS,1); | |
| 2935 | 23 | } | |
| 2936 | |||
| 2937 |
5/6✓ Branch 0 taken 391 times.
✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 391 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 2 times.
|
416 | if((tempheader.zelda_version < 0x193)||((tempheader.zelda_version == 0x193)&&(tempheader.build<4))) |
| 2938 | { | ||
| 2939 | 23 | set_qr(qr_NOBOMBPALFLASH,1); | |
| 2940 | 23 | } | |
| 2941 | |||
| 2942 |
5/6✓ Branch 0 taken 391 times.
✓ Branch 1 taken 21 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 391 times.
✓ Branch 4 taken 6 times.
✓ Branch 5 taken 6 times.
|
416 | if((tempheader.zelda_version < 0x193)||((tempheader.zelda_version == 0x193)&&(tempheader.build<3))) |
| 2943 | { | ||
| 2944 | 27 | set_qr(qr_NOSCROLLCONTINUE,1); | |
| 2945 | 27 | } | |
| 2946 | |||
| 2947 |
2/2✓ Branch 0 taken 326 times.
✓ Branch 1 taken 82 times.
|
420 | if(tempheader.zelda_version <= 0x210) |
| 2948 | { | ||
| 2949 | 82 | set_qr(qr_ARROWCLIP,1); | |
| 2950 | 82 | } | |
| 2951 | |||
| 2952 |
2/2✓ Branch 0 taken 349 times.
✓ Branch 1 taken 59 times.
|
408 | if(tempheader.zelda_version == 0x210) |
| 2953 | { | ||
| 2954 | 59 | set_qr(qr_NOSCROLLCONTINUE, get_qr(qr_CMBCYCLELAYERS)); | |
| 2955 | 59 | set_qr(qr_CMBCYCLELAYERS, 0); | |
| 2956 | 59 | set_qr(qr_CONT_SWORD_TRIGGERS, 1); | |
| 2957 | 59 | } | |
| 2958 | |||
| 2959 |
2/2✓ Branch 0 taken 326 times.
✓ Branch 1 taken 82 times.
|
408 | if(tempheader.zelda_version <= 0x210) |
| 2960 | { | ||
| 2961 | 82 | set_qr(qr_OLDSTYLEWARP,1); | |
| 2962 | 82 | set_qr(qr_210_WARPRETURN,1); | |
| 2963 | 82 | } | |
| 2964 | |||
| 2965 | //might not be correct | ||
| 2966 |
2/2✓ Branch 0 taken 385 times.
✓ Branch 1 taken 23 times.
|
408 | if(tempheader.zelda_version < 0x210) |
| 2967 | { | ||
| 2968 | 23 | set_bit(deprecated_rules, qr_OLDTRIBBLES_DEP,1); | |
| 2969 | 23 | set_qr(qr_OLDTRIBBLES_DEP,1); | |
| 2970 | 23 | set_qr(qr_OLDHOOKSHOTGRAB,1); | |
| 2971 | 23 | } | |
| 2972 | |||
| 2973 |
2/2✓ Branch 0 taken 326 times.
✓ Branch 1 taken 82 times.
|
408 | if(tempheader.zelda_version < 0x211) |
| 2974 | { | ||
| 2975 | 82 | set_qr(qr_WRONG_BRANG_TRAIL_DIR,1); | |
| 2976 | 82 | } | |
| 2977 | |||
| 2978 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 403 times.
✓ Branch 2 taken 17 times.
✓ Branch 3 taken 386 times.
|
408 | if((tempheader.zelda_version == 0x192 && tempheader.build <= 163) || tempheader.zelda_version < 0x192) |
| 2979 | { | ||
| 2980 | 22 | set_qr(qr_192b163_WARP,1); | |
| 2981 | 22 | } | |
| 2982 | |||
| 2983 |
2/2✓ Branch 0 taken 349 times.
✓ Branch 1 taken 59 times.
|
408 | if(tempheader.zelda_version == 0x210) |
| 2984 | { | ||
| 2985 | 59 | set_bit(deprecated_rules, qr_OLDTRIBBLES_DEP, get_qr(qr_DMGCOMBOPRI)); | |
| 2986 | 59 | set_qr(qr_OLDTRIBBLES_DEP, get_qr(qr_DMGCOMBOPRI)); | |
| 2987 | 59 | set_qr(qr_DMGCOMBOPRI, 0); | |
| 2988 | 59 | } | |
| 2989 | |||
| 2990 |
5/6✓ Branch 0 taken 332 times.
✓ Branch 1 taken 76 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 332 times.
✓ Branch 4 taken 6 times.
✓ Branch 5 taken 6 times.
|
408 | if(tempheader.zelda_version < 0x211 || (tempheader.zelda_version == 0x211 && tempheader.build<15)) |
| 2991 | { | ||
| 2992 | 82 | set_qr(qr_OLDPICKUP,1); | |
| 2993 | 82 | } | |
| 2994 | |||
| 2995 |
5/6✓ Branch 0 taken 332 times.
✓ Branch 1 taken 76 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 332 times.
✓ Branch 4 taken 6 times.
✓ Branch 5 taken 6 times.
|
420 | if(tempheader.zelda_version < 0x211 || (tempheader.zelda_version == 0x211 && tempheader.build < 18)) |
| 2996 | { | ||
| 2997 | 82 | set_qr(qr_NOSOLIDDAMAGECOMBOS, 1); | |
| 2998 | 82 | set_qr(qr_ITEMPICKUPSETSBELOW, 1); // broke around build 400 | |
| 2999 | 82 | } | |
| 3000 | |||
| 3001 |
2/2✓ Branch 0 taken 326 times.
✓ Branch 1 taken 82 times.
|
420 | if(tempheader.zelda_version < 0x250) // version<0x250 checks for beta 18; build was set to 18 prematurely |
| 3002 | { | ||
| 3003 | 82 | set_qr(qr_HOOKSHOTDOWNBUG, 1); | |
| 3004 | 82 | } | |
| 3005 | |||
| 3006 |
4/4✓ Branch 0 taken 189 times.
✓ Branch 1 taken 219 times.
✓ Branch 2 taken 161 times.
✓ Branch 3 taken 28 times.
|
408 | if(tempheader.zelda_version == 0x250 && tempheader.build == 24) // Annoying... |
| 3007 | { | ||
| 3008 | 28 | set_qr(qr_PEAHATCLOCKVULN, 1); | |
| 3009 | 28 | } | |
| 3010 | |||
| 3011 |
6/6✓ Branch 0 taken 332 times.
✓ Branch 1 taken 76 times.
✓ Branch 2 taken 189 times.
✓ Branch 3 taken 143 times.
✓ Branch 4 taken 6 times.
✓ Branch 5 taken 183 times.
|
408 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build < 22)) //22 is 2.50.0 RC4. Gotta set the door repair QR... -Dimi |
| 3012 | { | ||
| 3013 | 82 | set_qr(qr_OLD_DOORREPAIR, 1); | |
| 3014 | 82 | } | |
| 3015 | |||
| 3016 |
6/6✓ Branch 0 taken 332 times.
✓ Branch 1 taken 76 times.
✓ Branch 2 taken 189 times.
✓ Branch 3 taken 143 times.
✓ Branch 4 taken 6 times.
✓ Branch 5 taken 195 times.
|
408 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build < 20)) //20 is 2.50.0 RC1 and RC2 (cause it didn't get bumped). Okay I'm gonna be honest I have no idea if any 2.50 build was available before RC1, but gonna try and cover my ass here -Dimi |
| 3017 | { | ||
| 3018 | 82 | set_qr(qr_OLD_SECRETMONEY, 1); | |
| 3019 | 82 | } | |
| 3020 | |||
| 3021 |
6/6✓ Branch 0 taken 332 times.
✓ Branch 1 taken 88 times.
✓ Branch 2 taken 189 times.
✓ Branch 3 taken 143 times.
✓ Branch 4 taken 46 times.
✓ Branch 5 taken 143 times.
|
420 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build < 28)) //28 is 2.50.1 final. Potion bug might have been used, I dunno. -Dimi |
| 3022 | { | ||
| 3023 | 134 | set_qr(qr_OLD_POTION_OR_HC, 1); | |
| 3024 | 134 | } | |
| 3025 | |||
| 3026 |
6/6✓ Branch 0 taken 332 times.
✓ Branch 1 taken 88 times.
✓ Branch 2 taken 189 times.
✓ Branch 3 taken 143 times.
✓ Branch 4 taken 46 times.
✓ Branch 5 taken 143 times.
|
420 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build<28)) |
| 3027 | { | ||
| 3028 | 134 | set_qr(qr_OFFSCREENWEAPONS, 1); | |
| 3029 | 134 | } | |
| 3030 | |||
| 3031 | //Bombchu fix. | ||
| 3032 |
2/2✓ Branch 0 taken 231 times.
✓ Branch 1 taken 189 times.
|
420 | if(tempheader.zelda_version == 0x250) |
| 3033 | { | ||
| 3034 |
2/2✓ Branch 0 taken 161 times.
✓ Branch 1 taken 28 times.
|
189 | if ( tempheader.build == 24 ) //2.50.0 |
| 3035 | { | ||
| 3036 | 28 | set_qr(qr_BOMBCHUSUPERBOMB, 1); | |
| 3037 | 28 | } | |
| 3038 |
2/2✓ Branch 0 taken 183 times.
✓ Branch 1 taken 6 times.
|
189 | if ( tempheader.build == 28 ) //2.50.1 |
| 3039 | { | ||
| 3040 | 6 | set_qr(qr_BOMBCHUSUPERBOMB, 1); | |
| 3041 | 6 | } | |
| 3042 |
2/2✓ Branch 0 taken 108 times.
✓ Branch 1 taken 81 times.
|
189 | if ( tempheader.build == 29 ) //2.50.2 |
| 3043 | { | ||
| 3044 | 81 | set_qr(qr_BOMBCHUSUPERBOMB, 0); | |
| 3045 | 81 | } | |
| 3046 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if ( tempheader.build == 30 ) //2.50.3RC1 |
| 3047 | { | ||
| 3048 | ✗ | set_qr(qr_BOMBCHUSUPERBOMB, 0); | |
| 3049 | ✗ | } | |
| 3050 | 189 | } | |
| 3051 | |||
| 3052 |
6/6✓ Branch 0 taken 332 times.
✓ Branch 1 taken 88 times.
✓ Branch 2 taken 189 times.
✓ Branch 3 taken 143 times.
✓ Branch 4 taken 52 times.
✓ Branch 5 taken 161 times.
|
420 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build<29)) |
| 3053 | { | ||
| 3054 | // qr_OFFSETEWPNCOLLISIONFIX | ||
| 3055 | // All 'official' quests need this disabled. | ||
| 3056 | // All 2.10 and lower quests need this enabled to preseve compatability. | ||
| 3057 | // All 2.11 - 2.5.1 quests should have it set also, due to a bug in about half of all the betas. | ||
| 3058 | |||
| 3059 | //~Gleeok | ||
| 3060 | 140 | set_qr(qr_OFFSETEWPNCOLLISIONFIX, 1); //This has to be set!!!! | |
| 3061 | |||
| 3062 | // Broke in build 695 | ||
| 3063 |
3/4✓ Branch 0 taken 58 times.
✓ Branch 1 taken 82 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 58 times.
|
140 | if(tempheader.zelda_version>=0x211 && tempheader.build>=18) |
| 3064 | 58 | set_qr(qr_BROKENSTATUES, 1); | |
| 3065 | 140 | } | |
| 3066 |
11/14✓ Branch 0 taken 48 times.
✓ Branch 1 taken 396 times.
✓ Branch 2 taken 391 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 439 times.
✓ Branch 7 taken 5 times.
✓ Branch 8 taken 439 times.
✓ Branch 9 taken 5 times.
✓ Branch 10 taken 422 times.
✓ Branch 11 taken 22 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
|
444 | if (tempheader.zelda_version <= 0x190 || (tempheader.zelda_version == 0x192 && std::string(tempheader.title).starts_with("Zelda 3000\0"))) |
| 3067 | { | ||
| 3068 | 22 | set_qr(qr_COPIED_SWIM_SPRITES, 1); | |
| 3069 | 22 | } | |
| 3070 |
9/10✓ Branch 0 taken 189 times.
✓ Branch 1 taken 255 times.
✓ Branch 2 taken 240 times.
✓ Branch 3 taken 15 times.
✓ Branch 4 taken 158 times.
✓ Branch 5 taken 82 times.
✓ Branch 6 taken 143 times.
✓ Branch 7 taken 15 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 143 times.
|
444 | if ( (tempheader.zelda_version == 0x250 && tempheader.build < 33) || tempheader.zelda_version == 0x254 || tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x255 && tempheader.build < 50) ) |
| 3071 | { | ||
| 3072 | 286 | set_qr(qr_OLD_SLASHNEXT_SECRETS, 1); | |
| 3073 | 286 | } | |
| 3074 | |||
| 3075 |
2/2✓ Branch 0 taken 332 times.
✓ Branch 1 taken 82 times.
|
414 | if ( (tempheader.zelda_version < 0x211) ) //2.10 water and ladder interaction |
| 3076 | { | ||
| 3077 | 82 | set_qr(qr_OLD_210_WATER, 1); | |
| 3078 | 82 | } | |
| 3079 | |||
| 3080 |
4/6✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 143 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 143 times.
|
414 | if ( (tempheader.zelda_version < 0x255 ) || (tempheader.zelda_version == 0x255 && tempheader.build < 51 ) ) //2.10 water and ladder interaction |
| 3081 | { | ||
| 3082 | 271 | set_qr(qr_STEP_IS_FLOAT,0); | |
| 3083 | 271 | } | |
| 3084 | |||
| 3085 |
2/2✓ Branch 0 taken 332 times.
✓ Branch 1 taken 82 times.
|
414 | if ( tempheader.zelda_version < 0x250 ) |
| 3086 | { | ||
| 3087 | 82 | set_qr(qr_8WAY_SHOT_SFX_DEP, 1); | |
| 3088 | 82 | } | |
| 3089 | |||
| 3090 |
2/2✓ Branch 0 taken 332 times.
✓ Branch 1 taken 82 times.
|
414 | if(s_version < 3) |
| 3091 | { | ||
| 3092 | 82 | set_qr(qr_HOLDNOSTOPMUSIC, 1); | |
| 3093 | 82 | set_qr(qr_CAVEEXITNOSTOPMUSIC, 1); | |
| 3094 | 82 | } | |
| 3095 | |||
| 3096 |
2/2✓ Branch 0 taken 332 times.
✓ Branch 1 taken 82 times.
|
414 | if(s_version<4) |
| 3097 | { | ||
| 3098 | 82 | set_qr(10,0); | |
| 3099 | 82 | } | |
| 3100 | |||
| 3101 |
2/2✓ Branch 0 taken 332 times.
✓ Branch 1 taken 82 times.
|
414 | if(s_version<5) |
| 3102 | { | ||
| 3103 | 82 | set_qr(27,0); | |
| 3104 | 82 | } | |
| 3105 | |||
| 3106 |
2/2✓ Branch 0 taken 332 times.
✓ Branch 1 taken 82 times.
|
414 | if(s_version<6) |
| 3107 | { | ||
| 3108 | 82 | set_qr(46,0); | |
| 3109 | 82 | } | |
| 3110 | |||
| 3111 |
2/2✓ Branch 0 taken 332 times.
✓ Branch 1 taken 82 times.
|
414 | if(s_version<7) // January 2008 |
| 3112 | { | ||
| 3113 | 82 | set_qr(qr_HEARTSREQUIREDFIX,0); | |
| 3114 | 82 | set_qr(qr_PUSHBLOCKCSETFIX,1); | |
| 3115 | 82 | } | |
| 3116 | |||
| 3117 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 332 times.
|
414 | if(s_version<8) |
| 3118 | { | ||
| 3119 | 82 | set_qr(12, 0); | |
| 3120 | 82 | } | |
| 3121 | else | ||
| 3122 | { | ||
| 3123 | 332 | set_bit(deprecated_rules, 12, 0); | |
| 3124 | } | ||
| 3125 | |||
| 3126 |
2/2✓ Branch 0 taken 332 times.
✓ Branch 1 taken 82 times.
|
414 | if(s_version<9) // October 2008 |
| 3127 | { | ||
| 3128 | 82 | set_qr(qr_NOROPE2FLASH_DEP,0); | |
| 3129 | 82 | set_qr(qr_NOBUBBLEFLASH_DEP,0); | |
| 3130 | 82 | set_qr(qr_GHINI2BLINK_DEP,0); | |
| 3131 | 82 | set_qr(qr_PHANTOMGHINI2_DEP,0); | |
| 3132 | 82 | } | |
| 3133 | |||
| 3134 |
2/2✓ Branch 0 taken 332 times.
✓ Branch 1 taken 82 times.
|
414 | if(s_version<10) // December 2008 |
| 3135 | { | ||
| 3136 | 82 | set_qr(qr_NOCLOCKS_DEP,0); | |
| 3137 | 82 | set_qr(qr_ALLOW10RUPEEDROPS_DEP,0); | |
| 3138 | 82 | } | |
| 3139 | |||
| 3140 |
2/2✓ Branch 0 taken 332 times.
✓ Branch 1 taken 82 times.
|
414 | if(s_version<11) // April 2009 |
| 3141 | { | ||
| 3142 | 82 | set_qr(qr_SLOWENEMYANIM_DEP,0); | |
| 3143 | 82 | } | |
| 3144 | |||
| 3145 | // This served no purpose. | ||
| 3146 | // if(s_version<12) // December 2009 | ||
| 3147 | // { | ||
| 3148 | // set_qr(qr_BRKBLSHLDS_DEP,0); | ||
| 3149 | // set_qr(qr_OLDTRIBBLES_DEP,0); | ||
| 3150 | // } | ||
| 3151 | |||
| 3152 | //if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build < 24)) | ||
| 3153 |
2/2✓ Branch 0 taken 332 times.
✓ Branch 1 taken 82 times.
|
414 | if(s_version < 13) |
| 3154 | { | ||
| 3155 | 82 | set_qr(qr_SHOPCHEAT, 1); | |
| 3156 | 82 | } | |
| 3157 | |||
| 3158 | // Not entirely sure this is the best place for this... | ||
| 3159 | //2.50.2 bitmap offset fix | ||
| 3160 | 414 | memset(extra_rules, 0, EXTRARULES_SIZE); | |
| 3161 |
6/6✓ Branch 0 taken 332 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 189 times.
✓ Branch 3 taken 143 times.
✓ Branch 4 taken 58 times.
✓ Branch 5 taken 131 times.
|
414 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build<29)) |
| 3162 | { | ||
| 3163 | 140 | set_er(er_BITMAPOFFSET, 1); | |
| 3164 | 140 | set_qr(qr_BITMAPOFFSETFIX, 1); | |
| 3165 | 140 | } | |
| 3166 | //required because quest templates also used this bit, although | ||
| 3167 | //it never did anything, before. -Z | ||
| 3168 |
2/2✓ Branch 0 taken 225 times.
✓ Branch 1 taken 189 times.
|
414 | if ( tempheader.zelda_version == 0x250 ) |
| 3169 | { | ||
| 3170 |
5/6✓ Branch 0 taken 108 times.
✓ Branch 1 taken 81 times.
✓ Branch 2 taken 108 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 16 times.
✓ Branch 5 taken 92 times.
|
189 | if( tempheader.build == 29 || tempheader.build == 30 || tempheader.build == 31 ) |
| 3171 | { | ||
| 3172 | 97 | set_er(er_BITMAPOFFSET, 0); | |
| 3173 | 97 | set_qr(qr_BITMAPOFFSETFIX, 0); | |
| 3174 | 97 | } | |
| 3175 | 189 | } | |
| 3176 |
1/2✓ Branch 0 taken 414 times.
✗ Branch 1 not taken.
|
414 | if ( tempheader.zelda_version == 0x254 ) |
| 3177 | { | ||
| 3178 | ✗ | set_er(er_BITMAPOFFSET, 0); | |
| 3179 | ✗ | set_qr(qr_BITMAPOFFSETFIX, 0); | |
| 3180 | ✗ | } | |
| 3181 |
3/4✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 143 times.
✗ Branch 3 not taken.
|
414 | if ( tempheader.zelda_version == 0x255 && tempheader.build < 42 ) //QR was added to 255 in this build. |
| 3182 | { | ||
| 3183 | ✗ | set_er(er_BITMAPOFFSET, 0); | |
| 3184 | ✗ | set_qr(qr_BITMAPOFFSETFIX, 0); | |
| 3185 | ✗ | } | |
| 3186 | //optimise fast drawing for older versions. | ||
| 3187 |
4/6✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 143 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 143 times.
|
414 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 42) ) |
| 3188 | { | ||
| 3189 | 271 | set_qr(qr_OLDSPRITEDRAWS, 1); | |
| 3190 | 271 | } | |
| 3191 | //Old eweapon->Parent (was added in 2.54, Alpha 19) | ||
| 3192 | //The change was made in build 43, but I'm setting this to < 42, because quests made in 42 would benefit from this change, and | ||
| 3193 | //older quests can set the rule by hand. We need a new qst.dat again. | ||
| 3194 |
4/6✓ Branch 0 taken 414 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 143 times.
✓ Branch 3 taken 271 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 143 times.
|
414 | if ( tempheader.zelda_version == 0x254 || (tempheader.zelda_version == 0x255 && tempheader.build < 42) ) |
| 3195 | { | ||
| 3196 | ✗ | set_qr(qr_OLDEWPNPARENT, 1); | |
| 3197 | ✗ | } | |
| 3198 |
4/6✓ Branch 0 taken 414 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 143 times.
✓ Branch 3 taken 271 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 143 times.
|
414 | if ( tempheader.zelda_version == 0x254 || (tempheader.zelda_version == 0x255 && tempheader.build < 44) ) |
| 3199 | { | ||
| 3200 | ✗ | set_qr(qr_OLDCREATEBITMAP_ARGS, 1); | |
| 3201 | ✗ | } | |
| 3202 |
4/6✓ Branch 0 taken 414 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 143 times.
✓ Branch 3 taken 271 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 143 times.
|
414 | if ( tempheader.zelda_version == 0x254 || (tempheader.zelda_version == 0x255 && tempheader.build < 45) ) |
| 3203 | { | ||
| 3204 | ✗ | set_qr(qr_OLDQUESTMISC, 1); | |
| 3205 | ✗ | } | |
| 3206 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if ( tempheader.zelda_version < 0x254 ) |
| 3207 | { | ||
| 3208 | 271 | set_qr(qr_OLDCREATEBITMAP_ARGS, 0); | |
| 3209 | 271 | set_qr(qr_OLDEWPNPARENT, 0); | |
| 3210 | 271 | set_qr(qr_OLDQUESTMISC, 0); | |
| 3211 | 271 | } | |
| 3212 | |||
| 3213 | //item scripts continue to run | ||
| 3214 |
4/6✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 143 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 143 times.
|
414 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 44) ) |
| 3215 | { | ||
| 3216 | 271 | set_qr(qr_ITEMSCRIPTSKEEPRUNNING, 0); | |
| 3217 | 271 | set_qr(qr_SCRIPTSRUNINHEROSTEPFORWARD, 0); | |
| 3218 | 271 | set_qr(qr_FIXSCRIPTSDURINGSCROLLING, 0); | |
| 3219 | 271 | set_qr(qr_SCRIPTDRAWSINWARPS, 0); | |
| 3220 | 271 | set_qr(qr_DYINGENEMYESDONTHURTHERO, 0); | |
| 3221 | 271 | set_qr(qr_OUTOFBOUNDSENEMIES, 0); | |
| 3222 | 271 | set_qr(qr_SPRITEXY_IS_FLOAT, 0); | |
| 3223 | 271 | } | |
| 3224 | |||
| 3225 |
4/6✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 143 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 143 times.
|
414 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 46) ) |
| 3226 | { | ||
| 3227 | 271 | set_qr(qr_CLEARINITDONSCRIPTCHANGE, 1); | |
| 3228 | 271 | } | |
| 3229 |
4/6✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 143 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 143 times.
|
414 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 46) ) |
| 3230 | { | ||
| 3231 | 271 | set_qr(qr_TRACESCRIPTIDS, 0); | |
| 3232 | 271 | set_qr(qr_SCRIPT_FRIENDLY_ENEMY_TYPES, 1); | |
| 3233 | 271 | set_qr(qr_PARSER_BOOL_TRUE_DECIMAL, 1); | |
| 3234 | 271 | set_qr(qr_PARSER_250DIVISION,1); | |
| 3235 | 271 | set_qr(qr_PARSER_BOOL_TRUE_DECIMAL,1); | |
| 3236 | 271 | set_qr(qr_PARSER_TRUE_INT_SIZE,0); | |
| 3237 | 271 | set_qr(qr_PARSER_FORCE_INLINE,0); | |
| 3238 | 271 | set_qr(qr_PARSER_BINARY_32BIT,0); | |
| 3239 |
2/2✓ Branch 0 taken 264 times.
✓ Branch 1 taken 7 times.
|
271 | if ( get_qr(qr_SELECTAWPN) ) |
| 3240 | { | ||
| 3241 | 7 | set_qr(qr_NO_L_R_BUTTON_INVENTORY_SWAP,1); | |
| 3242 | //In < 2.55a27, if you had an A+B subscreen, L and R didn't shift through inventory. | ||
| 3243 | //Now they **do**, unless you disable that behaviour. | ||
| 3244 | //For the sake of compatibility, old quests with the A+B subscreen rule enabed | ||
| 3245 | //now enable the disable L/R item swap on load. | ||
| 3246 | 7 | } | |
| 3247 | |||
| 3248 | 271 | } | |
| 3249 |
4/6✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 143 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 143 times.
|
414 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 47) ) |
| 3250 | { | ||
| 3251 | //Compatibility: Setting the hero's action to rafting was previously disallowed, though legal for scripts to attempt. | ||
| 3252 | 271 | set_qr(qr_DISALLOW_SETTING_RAFTING, 1); | |
| 3253 | //Compatibility: The calculation for when to loop an animation did not factor in ASkipY correctly, resulting in | ||
| 3254 | //animations ending earlier than they should. | ||
| 3255 | 271 | set_qr(qr_BROKEN_ASKIP_Y_FRAMES, 1); | |
| 3256 | //Enemies would ignore solidity on the top half of combos | ||
| 3257 | 271 | set_qr(qr_ENEMY_BROKEN_TOP_HALF_SOLIDITY, 1); | |
| 3258 | //Ceiling collison was a bit wonky, including hitting your head before you are near the ceiling or clipping into it slightly. | ||
| 3259 | 271 | set_qr(qr_OLD_SIDEVIEW_CEILING_COLLISON, 1); | |
| 3260 | //If an itemdata had a 'frames' of 0, items created of that data would ignore all changes to 'frames' | ||
| 3261 | 271 | set_qr(qr_0AFRAME_ITEMS_IGNORE_AFRAME_CHANGES, 1); | |
| 3262 | //Collision used some odd calculations before, and enemies could not be hit back into the top row or left column | ||
| 3263 | 271 | set_qr(qr_OLD_ENEMY_KNOCKBACK_COLLISION, 1); | |
| 3264 | 271 | } | |
| 3265 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if ( tempheader.zelda_version < 0x255 ) |
| 3266 | { | ||
| 3267 | 271 | set_qr(qr_NOFFCWAITDRAW, 1); | |
| 3268 | 271 | set_qr(qr_NOITEMWAITDRAW, 1); | |
| 3269 | 271 | set_qr(qr_SETENEMYWEAPONSPRITESONWPNCHANGE, 1); | |
| 3270 | 271 | set_qr(qr_OLD_INIT_SCRIPT_TIMING, 1); | |
| 3271 | //set_qr(qr_DO_NOT_DEALLOCATE_INIT_AND_SAVELOAD_ARRAYS, 1); | ||
| 3272 | 271 | } | |
| 3273 |
4/6✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 143 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 143 times.
|
414 | if ( tempheader.zelda_version < 0x255 || ( tempheader.zelda_version == 0x255 && tempheader.build < 48 ) ) |
| 3274 | { | ||
| 3275 | 271 | set_qr(qr_SETENEMYWEAPONSPRITESONWPNCHANGE, 1); | |
| 3276 | 271 | } | |
| 3277 |
4/6✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 143 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 143 times.
|
414 | if( tempheader.zelda_version < 0x255 || ( tempheader.zelda_version == 0x255 && tempheader.build < 52 ) ) |
| 3278 | { | ||
| 3279 | 271 | set_qr(qr_OLD_PRINTF_ARGS, 1); | |
| 3280 | 271 | } | |
| 3281 | |||
| 3282 | |||
| 3283 |
4/6✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 143 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 143 times.
|
414 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 54) ) |
| 3284 | { | ||
| 3285 | 271 | set_qr(qr_BROKEN_RING_POWER, 1); | |
| 3286 | 271 | } | |
| 3287 |
4/6✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 143 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 143 times.
|
414 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 56) ) |
| 3288 | { | ||
| 3289 | 271 | set_qr(qr_NO_OVERWORLD_MAP_CHARTING, 1); | |
| 3290 | 271 | } | |
| 3291 |
4/6✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 143 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 143 times.
|
414 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 57) ) |
| 3292 | { | ||
| 3293 | 271 | set_qr(qr_DUNGEONS_USE_CLASSIC_CHARTING, 1); | |
| 3294 | 271 | } | |
| 3295 |
4/6✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 143 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 143 times.
|
414 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 58) ) |
| 3296 | { | ||
| 3297 | //Rule used to be 'qr_SETXYBUTTONITEMS', now split. | ||
| 3298 |
1/2✓ Branch 0 taken 271 times.
✗ Branch 1 not taken.
|
271 | if(get_qr(qr_SET_XBUTTON_ITEMS)) |
| 3299 | ✗ | set_qr(qr_SET_YBUTTON_ITEMS,1); | |
| 3300 | 271 | } | |
| 3301 |
4/6✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 143 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 143 times.
|
414 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 59) ) |
| 3302 | { | ||
| 3303 | 271 | set_qr(qr_ALLOW_EDITING_COMBO_0,1); | |
| 3304 | 271 | } | |
| 3305 |
4/6✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 143 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 143 times.
|
414 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 60) ) |
| 3306 | { | ||
| 3307 | 271 | set_qr(qr_OLD_CHEST_COLLISION,1); | |
| 3308 | 271 | } | |
| 3309 | |||
| 3310 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if ( tempheader.zelda_version < 0x254 ) |
| 3311 | { | ||
| 3312 | 271 | set_qr(qr_250WRITEEDEFSCRIPT, 1); | |
| 3313 | 271 | } | |
| 3314 | //Sideview spikes in 2.50.0 | ||
| 3315 |
6/6✓ Branch 0 taken 332 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 189 times.
✓ Branch 3 taken 143 times.
✓ Branch 4 taken 52 times.
✓ Branch 5 taken 137 times.
|
414 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build<27)) //2.50.1RC3 |
| 3316 | { | ||
| 3317 | 134 | set_qr(qr_OLDSIDEVIEWSPIKES, 1); | |
| 3318 | 134 | } | |
| 3319 | //more 2.50 fixes -Z | ||
| 3320 |
6/6✓ Branch 0 taken 332 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 189 times.
✓ Branch 3 taken 143 times.
✓ Branch 4 taken 139 times.
✓ Branch 5 taken 50 times.
|
414 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build<31)) |
| 3321 | { | ||
| 3322 | 221 | set_qr(qr_MELEEMAGICCOST, 0); | |
| 3323 | 221 | set_qr(qr_GANONINTRO, 0); //This will get flipped later on in the compatrule 11 check. That's why it's turning it off. | |
| 3324 | 221 | set_qr(qr_OLDMIRRORCOMBOS, 1); | |
| 3325 | 221 | set_qr(qr_BROKENBOOKCOST, 1); | |
| 3326 | 221 | set_qr(qr_BROKENCHARINTDRAWING, 1); | |
| 3327 | |||
| 3328 | 221 | } | |
| 3329 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 414 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
414 | if(tempheader.zelda_version == 0x254 && tempheader.build<41) |
| 3330 | { | ||
| 3331 | //set_qr(qr_MELEEMAGICCOST, get_er(er_MAGICCOSTSWORD)); | ||
| 3332 | ✗ | set_qr(qr_MELEEMAGICCOST, 1); | |
| 3333 | ✗ | } | |
| 3334 | |||
| 3335 |
2/2✓ Branch 0 taken 391 times.
✓ Branch 1 taken 23 times.
|
414 | if(tempheader.zelda_version < 0x193) |
| 3336 | { | ||
| 3337 | 23 | set_qr(qr_SHORTDGNWALK, 1); | |
| 3338 | 23 | } | |
| 3339 | |||
| 3340 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if(tempheader.zelda_version < 0x255) |
| 3341 | { | ||
| 3342 | 271 | set_qr(qr_OLDINFMAGIC, 1); | |
| 3343 | 271 | } | |
| 3344 | |||
| 3345 |
2/2✓ Branch 0 taken 332 times.
✓ Branch 1 taken 82 times.
|
414 | if((tempheader.zelda_version < 0x250)) //2.10 and earlier allowed the triforce to Warp Player out of Item Cellars in Dungeons. -Z (15th March, 2019 ) |
| 3346 | { | ||
| 3347 | 82 | set_qr(qr_SIDEVIEWTRIFORCECELLAR,1); | |
| 3348 | 82 | } | |
| 3349 | |||
| 3350 |
4/6✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 143 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 143 times.
|
414 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 47) ) |
| 3351 | { | ||
| 3352 | 271 | set_qr(qr_OLD_F6,1); | |
| 3353 | 271 | } | |
| 3354 |
4/6✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 143 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 143 times.
|
414 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 49) ) |
| 3355 | { | ||
| 3356 | 271 | set_qr(qr_NO_OVERWRITING_HOPPING,1); | |
| 3357 | 271 | } | |
| 3358 |
4/6✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 143 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 143 times.
|
414 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 50) ) |
| 3359 | { | ||
| 3360 | 271 | set_qr(qr_STRING_FRAME_OLD_WIDTH_HEIGHT,1); | |
| 3361 | 271 | } | |
| 3362 |
4/6✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
✓ Branch 2 taken 143 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 143 times.
|
414 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 53) ) |
| 3363 | { | ||
| 3364 | 271 | set_qr(qr_BROKEN_OVERWORLD_MINIMAP,1); | |
| 3365 | 271 | } | |
| 3366 | //} | ||
| 3367 | |||
| 3368 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if(compatrule_version < 1) //Enemies->Secret only affects flag 16-31 |
| 3369 | 271 | set_qr(qr_ENEMIES_SECRET_ONLY_16_31,1); | |
| 3370 | |||
| 3371 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if(compatrule_version < 2) //Old CSet2 Handling |
| 3372 | 271 | set_qr(qr_OLDCS2,1); | |
| 3373 | |||
| 3374 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if(compatrule_version < 3) //Hardcoded Shadow/Spawn/Death anim frames |
| 3375 | 271 | set_qr(qr_HARDCODED_ENEMY_ANIMS,1); | |
| 3376 | |||
| 3377 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if(compatrule_version < 4) //Hardcoded Shadow/Spawn/Death anim frames |
| 3378 | 271 | set_qr(qr_OLD_ITEMDATA_SCRIPT_TIMING,1); | |
| 3379 | |||
| 3380 |
4/4✓ Branch 0 taken 271 times.
✓ Branch 1 taken 143 times.
✓ Branch 2 taken 82 times.
✓ Branch 3 taken 189 times.
|
414 | if(compatrule_version < 5 && tempheader.zelda_version >= 0x250) //Hardcoded Shadow/Spawn/Death anim frames |
| 3381 | 189 | set_qr(qr_NO_LANMOLA_RINGLEADER,1); | |
| 3382 | |||
| 3383 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if(compatrule_version < 6) //Step->Secret (Temp) only affects flag 16-31 |
| 3384 | 271 | set_qr(qr_STEPTEMP_SECRET_ONLY_16_31,1); | |
| 3385 | |||
| 3386 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if(compatrule_version < 7) //'Hit All Triggers->Perm Secret' doesn't trigger temp secrets |
| 3387 | 271 | set_qr(qr_ALLTRIG_PERMSEC_NO_TEMP,1); | |
| 3388 | |||
| 3389 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if(compatrule_version < 8) //Hardcoded LItem/Bomb/Clock/Magic Tile Mods |
| 3390 | 271 | set_qr(qr_HARDCODED_LITEM_LTMS,1); | |
| 3391 | |||
| 3392 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if(compatrule_version < 9) |
| 3393 | { | ||
| 3394 | //Hardcoded BS Patras | ||
| 3395 | 271 | set_qr(qr_HARDCODED_BS_PATRA,1); | |
| 3396 | //Hardcoded Patra Inner Eye offsets | ||
| 3397 | 271 | set_qr(qr_PATRAS_USE_HARDCODED_OFFSETS,1); | |
| 3398 | //Broken 'Big enemy' animation style | ||
| 3399 | 271 | set_qr(qr_BROKEN_BIG_ENEMY_ANIMATION,1); | |
| 3400 | //Broken Attribute 31/32 | ||
| 3401 | 271 | set_qr(qr_BROKEN_ATTRIBUTE_31_32,1); | |
| 3402 | 271 | } | |
| 3403 | |||
| 3404 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if(compatrule_version < 10) //Shared candle use limits |
| 3405 | 271 | set_qr(qr_CANDLES_SHARED_LIMIT,1); | |
| 3406 | |||
| 3407 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if(compatrule_version < 11) //No cross-screen return points |
| 3408 | 271 | set_qr(qr_OLD_RESPAWN_POINTS,1); | |
| 3409 | |||
| 3410 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if(compatrule_version < 12) |
| 3411 | { | ||
| 3412 | //Old fire trail duration | ||
| 3413 | 271 | set_qr(qr_OLD_FLAMETRAIL_DURATION,1); | |
| 3414 | //Old Intro String in Ganon Room Behavior | ||
| 3415 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 271 times.
|
271 | if(get_qr(qr_GANONINTRO)) set_qr(qr_GANONINTRO,0); |
| 3416 | 271 | else set_qr(qr_GANONINTRO,1); | |
| 3417 | 271 | } | |
| 3418 | |||
| 3419 |
3/4✓ Branch 0 taken 271 times.
✓ Branch 1 taken 143 times.
✓ Branch 2 taken 271 times.
✗ Branch 3 not taken.
|
414 | if(compatrule_version < 13 && tempheader.zelda_version >= 0x255) //ANone doesn't reset to originaltile |
| 3420 | ✗ | set_qr(qr_ANONE_NOANIM,1); | |
| 3421 | |||
| 3422 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if(compatrule_version < 14) //Old Bridge Combo Behavior |
| 3423 | 271 | set_qr(qr_OLD_BRIDGE_COMBOS,1); | |
| 3424 | |||
| 3425 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if(compatrule_version < 15) //Broken Z3 Animation |
| 3426 | 271 | set_qr(qr_BROKEN_Z3_ANIMATION,1); | |
| 3427 | |||
| 3428 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if(compatrule_version < 16) //Old Enemy Tile Behavior with Animation (None) Enemies |
| 3429 | 271 | set_qr(qr_OLD_TILE_INITIALIZATION,1); | |
| 3430 | |||
| 3431 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if(compatrule_version < 17) |
| 3432 | { | ||
| 3433 | //Old Quake/DrawYOffset behavior | ||
| 3434 | //set_qr(qr_OLD_DRAWOFFSET,1); | ||
| 3435 | //I'm leaving this commented cause I doubt it'll break anything and I think the bugfix might be appreciated in older versions. | ||
| 3436 | //On the offchance that it *does* break old quests, fixing it is as simple as uncommenting the set_bit above. | ||
| 3437 | 271 | } | |
| 3438 | |||
| 3439 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if(compatrule_version < 18) |
| 3440 | { | ||
| 3441 | //Broken DrawScreen Derivative Functions | ||
| 3442 | 271 | set_qr(qr_BROKEN_DRAWSCREEN_FUNCTIONS,1); | |
| 3443 | //Scrolling Cancels Charge | ||
| 3444 | 271 | set_qr(qr_SCROLLING_KILLS_CHARGE,1); | |
| 3445 | 271 | } | |
| 3446 | |||
| 3447 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if(compatrule_version < 19) //Broken Enemy Item Carrying with Large Enemies |
| 3448 | 271 | set_qr(qr_BROKEN_ITEM_CARRYING,1); | |
| 3449 | |||
| 3450 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if(compatrule_version < 20) |
| 3451 | 271 | set_qr(qr_CUSTOMWEAPON_IGNORE_COST,1); | |
| 3452 | |||
| 3453 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if(compatrule_version < 21) |
| 3454 | { | ||
| 3455 | 271 | set_qr(qr_LEEVERS_DONT_OBEY_STUN,1); | |
| 3456 | 271 | set_qr(qr_GANON_CANT_SPAWN_ON_CONTINUE,1); | |
| 3457 | 271 | set_qr(qr_WIZZROBES_DONT_OBEY_STUN,1); | |
| 3458 | 271 | set_qr(qr_OLD_BUG_NET,1); | |
| 3459 | 271 | set_qr(qr_MANHANDLA_BLOCK_SFX,1); | |
| 3460 | 271 | } | |
| 3461 | |||
| 3462 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if(compatrule_version < 22) |
| 3463 | 271 | set_qr(qr_BROKEN_KEEPOLD_FLAG,1); | |
| 3464 | |||
| 3465 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if(compatrule_version < 23) |
| 3466 | 271 | set_qr(qr_OLD_HALF_MAGIC,1); | |
| 3467 | |||
| 3468 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if(compatrule_version < 24) |
| 3469 | { | ||
| 3470 | 271 | set_qr(qr_WARPS_RESTART_DMAPSCRIPT,1); | |
| 3471 | 271 | set_qr(qr_DMAP_0_CONTINUE_BUG,1); | |
| 3472 | 271 | } | |
| 3473 | |||
| 3474 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if(compatrule_version < 25) |
| 3475 | { | ||
| 3476 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 271 times.
|
271 | if (get_qr(qr_OLD_FAIRY_LIMIT)) set_qr(qr_OLD_FAIRY_LIMIT,0); |
| 3477 | 271 | else set_qr(qr_OLD_FAIRY_LIMIT,1); | |
| 3478 | 271 | set_qr(qr_OLD_SCRIPTED_KNOCKBACK,1); | |
| 3479 | 271 | } | |
| 3480 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if(compatrule_version < 26) |
| 3481 | { | ||
| 3482 | 271 | set_qr(qr_OLD_KEESE_Z_AXIS,1); | |
| 3483 | 271 | set_qr(qr_POLVIRE_NO_SHADOW,1); | |
| 3484 | 271 | set_qr(qr_SUBSCR_OLD_SELECTOR,1); | |
| 3485 | 271 | } | |
| 3486 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if(compatrule_version < 27) //Noticed some junk data in the QR array... |
| 3487 | { | ||
| 3488 |
2/2✓ Branch 0 taken 81571 times.
✓ Branch 1 taken 271 times.
|
81842 | for(auto q = qr_POLVIRE_NO_SHADOW+1; q < qr_PARSER_250DIVISION; ++q) |
| 3489 | 81571 | set_qr(q,0); | |
| 3490 |
2/2✓ Branch 0 taken 1084 times.
✓ Branch 1 taken 271 times.
|
1355 | for(auto q = qr_COMBODATA_INITD_MULT_TENK+1; q < qr_MAX; ++q) |
| 3491 | 1084 | set_qr(q,0); | |
| 3492 | //This should nuke any remaining junk data... not sure if it affected anything previous. -Em | ||
| 3493 | 271 | } | |
| 3494 |
2/2✓ Branch 0 taken 138 times.
✓ Branch 1 taken 276 times.
|
414 | if(compatrule_version < 28) |
| 3495 | 276 | set_qr(qr_SUBSCR_BACKWARDS_ID_ORDER,1); | |
| 3496 |
2/2✓ Branch 0 taken 138 times.
✓ Branch 1 taken 276 times.
|
414 | if(compatrule_version < 29) |
| 3497 | 276 | set_qr(qr_OLD_LOCKBLOCK_COLLISION,1); | |
| 3498 |
2/2✓ Branch 0 taken 138 times.
✓ Branch 1 taken 276 times.
|
414 | if(compatrule_version < 30) |
| 3499 | { | ||
| 3500 | 276 | set_qr(qr_DECO_2_YOFFSET,1); | |
| 3501 | 276 | set_qr(qr_SCREENSTATE_80s_BUG,1); | |
| 3502 | 276 | } | |
| 3503 |
2/2✓ Branch 0 taken 138 times.
✓ Branch 1 taken 276 times.
|
414 | if(compatrule_version < 31) |
| 3504 | { | ||
| 3505 | 276 | set_qr(qr_GOHMA_UNDAMAGED_BUG,1); | |
| 3506 | 276 | set_qr(qr_FFCPRELOAD_BUGGED_LOAD,1); | |
| 3507 | 276 | } | |
| 3508 |
2/2✓ Branch 0 taken 138 times.
✓ Branch 1 taken 276 times.
|
414 | if(compatrule_version < 32) |
| 3509 | 276 | set_qr(qr_BROKEN_GETPIXEL_VALUE,1); | |
| 3510 |
2/2✓ Branch 0 taken 138 times.
✓ Branch 1 taken 276 times.
|
414 | if(compatrule_version < 33) |
| 3511 | 276 | set_qr(qr_NO_LIFT_SPRITE,1); | |
| 3512 |
2/2✓ Branch 0 taken 138 times.
✓ Branch 1 taken 276 times.
|
414 | if(compatrule_version < 34) |
| 3513 | { | ||
| 3514 | 276 | set_qr(qr_OLD_SIDEVIEW_LANDING_CODE,1); | |
| 3515 | 276 | set_qr(qr_OLD_FFC_SPEED_CAP,1); | |
| 3516 | 276 | set_qr(qr_OLD_FFC_FUNCTIONALITY,1); | |
| 3517 | 276 | set_qr(qr_OLD_WIZZROBE_SUBMERGING,1); | |
| 3518 | 276 | } | |
| 3519 |
2/2✓ Branch 0 taken 136 times.
✓ Branch 1 taken 278 times.
|
414 | if(compatrule_version < 35) |
| 3520 | { | ||
| 3521 | 278 | set_qr(qr_ZS_NO_NEG_ARRAY,1); | |
| 3522 | 278 | set_qr(qr_BROKEN_INPUT_DOWN_STATE,1); | |
| 3523 | 278 | } | |
| 3524 |
2/2✓ Branch 0 taken 136 times.
✓ Branch 1 taken 278 times.
|
414 | if(compatrule_version < 36) |
| 3525 | 278 | set_qr(qr_OLD_SHALLOW_SFX,1); | |
| 3526 |
2/2✓ Branch 0 taken 132 times.
✓ Branch 1 taken 282 times.
|
414 | if(compatrule_version < 37) |
| 3527 | 282 | set_qr(qr_SPARKLES_INHERIT_PROPERTIES,1); | |
| 3528 |
2/2✓ Branch 0 taken 132 times.
✓ Branch 1 taken 282 times.
|
414 | if(compatrule_version < 38) |
| 3529 | 282 | set_qr(qr_BUGGED_LAYERED_FLAGS,1); | |
| 3530 |
2/2✓ Branch 0 taken 132 times.
✓ Branch 1 taken 282 times.
|
414 | if(compatrule_version < 39) |
| 3531 | 282 | set_qr(qr_HARDCODED_FFC_BUSH_DROPS,1); | |
| 3532 |
2/2✓ Branch 0 taken 132 times.
✓ Branch 1 taken 282 times.
|
414 | if(compatrule_version < 40) |
| 3533 | 282 | set_qr(qr_MOVINGBLOCK_FAKE_SOLID,1); | |
| 3534 |
2/2✓ Branch 0 taken 130 times.
✓ Branch 1 taken 284 times.
|
414 | if(compatrule_version < 41) |
| 3535 | 284 | set_qr(qr_BROKENHITBY,1); | |
| 3536 |
2/2✓ Branch 0 taken 130 times.
✓ Branch 1 taken 284 times.
|
414 | if(compatrule_version < 42) |
| 3537 | 284 | set_qr(qr_BROKEN_MOVING_BOMBS,1); | |
| 3538 |
2/2✓ Branch 0 taken 130 times.
✓ Branch 1 taken 284 times.
|
414 | if(compatrule_version < 43) |
| 3539 | 284 | set_qr(qr_OLD_BOMB_HITBOXES,1); | |
| 3540 |
2/2✓ Branch 0 taken 130 times.
✓ Branch 1 taken 284 times.
|
414 | if(compatrule_version < 44) |
| 3541 | 284 | set_qr(qr_SCROLLWARP_NO_RESET_FRAME,1); | |
| 3542 |
2/2✓ Branch 0 taken 130 times.
✓ Branch 1 taken 284 times.
|
414 | if(compatrule_version < 45) |
| 3543 | 284 | set_qr(qr_ENEMIES_DONT_SCRIPT_FIRST_FRAME,1); | |
| 3544 |
2/2✓ Branch 0 taken 130 times.
✓ Branch 1 taken 284 times.
|
414 | if(compatrule_version < 46) |
| 3545 | 284 | set_qr(qr_BROKEN_RAFT_SCROLL,1); | |
| 3546 |
2/2✓ Branch 0 taken 126 times.
✓ Branch 1 taken 288 times.
|
414 | if(compatrule_version < 47) |
| 3547 | { | ||
| 3548 | 288 | set_qr(qr_SENSITIVE_SOLID_DAMAGE,1); | |
| 3549 | 288 | set_qr(qr_OLD_CONVEYOR_COLLISION,1); | |
| 3550 | 288 | } | |
| 3551 |
2/2✓ Branch 0 taken 126 times.
✓ Branch 1 taken 288 times.
|
414 | if(compatrule_version < 48) |
| 3552 | 288 | set_qr(qr_OLD_GUY_HANDLING,1); | |
| 3553 |
2/2✓ Branch 0 taken 126 times.
✓ Branch 1 taken 288 times.
|
414 | if(compatrule_version < 49) |
| 3554 | 288 | set_qr(qr_FAIRY_FLAG_COMPAT,1); | |
| 3555 |
2/2✓ Branch 0 taken 126 times.
✓ Branch 1 taken 288 times.
|
414 | if(compatrule_version < 50) |
| 3556 | 288 | set_qr(qr_OLD_LENS_LAYEREFFECT,1); | |
| 3557 |
2/2✓ Branch 0 taken 126 times.
✓ Branch 1 taken 288 times.
|
414 | if(compatrule_version < 51) |
| 3558 | 288 | set_qr(qr_PUSHBLOCK_SPRITE_LAYER,1); | |
| 3559 |
2/2✓ Branch 0 taken 126 times.
✓ Branch 1 taken 288 times.
|
414 | if (compatrule_version < 52) |
| 3560 | 288 | set_qr(qr_OLD_SCRIPT_VOLUME, 1); | |
| 3561 |
2/2✓ Branch 0 taken 126 times.
✓ Branch 1 taken 288 times.
|
414 | if(compatrule_version < 53) |
| 3562 | { | ||
| 3563 | 288 | set_qr(qr_OLD_SUBSCR,1); | |
| 3564 | 288 | set_qr(qr_ITM_0_INVIS_ON_BTNS,1); | |
| 3565 | 288 | set_qr(qr_OLD_GAUGE_TILE_LAYOUT,1); | |
| 3566 | 288 | } | |
| 3567 |
2/2✓ Branch 0 taken 126 times.
✓ Branch 1 taken 288 times.
|
414 | if(compatrule_version < 54) |
| 3568 | 288 | set_qr(qr_WALKTHROUGHWALL_NO_DOORSTATE,1); | |
| 3569 |
2/2✓ Branch 0 taken 126 times.
✓ Branch 1 taken 288 times.
|
414 | if(compatrule_version < 55) |
| 3570 | 288 | set_qr(qr_SPOTLIGHT_IGNR_SOLIDOBJ,1); | |
| 3571 |
2/2✓ Branch 0 taken 126 times.
✓ Branch 1 taken 288 times.
|
414 | if(compatrule_version < 56) |
| 3572 | 288 | set_qr(qr_BROKEN_LIGHTBEAM_HITBOX,1); | |
| 3573 |
2/2✓ Branch 0 taken 126 times.
✓ Branch 1 taken 288 times.
|
414 | if(compatrule_version < 57) |
| 3574 | 288 | set_qr(qr_BROKEN_SWORD_SPIN_TRIGGERS,1); | |
| 3575 |
2/2✓ Branch 0 taken 126 times.
✓ Branch 1 taken 288 times.
|
414 | if(compatrule_version < 58) |
| 3576 | 288 | set_qr(qr_OLD_DMAP_INTRO_STRINGS,1); | |
| 3577 |
2/2✓ Branch 0 taken 126 times.
✓ Branch 1 taken 288 times.
|
414 | if(compatrule_version < 59) |
| 3578 | 288 | set_qr(qr_SCRIPT_CONTHP_IS_HEARTS,1); | |
| 3579 |
2/2✓ Branch 0 taken 126 times.
✓ Branch 1 taken 288 times.
|
414 | if(compatrule_version < 60) |
| 3580 | 288 | set_qr(qr_SEPARATE_BOMBABLE_TAPPING_SFX,1); | |
| 3581 |
2/2✓ Branch 0 taken 126 times.
✓ Branch 1 taken 288 times.
|
414 | if(compatrule_version < 61) |
| 3582 | 288 | set_qr(qr_BROKEN_BOMB_AMMO_COSTS,1); | |
| 3583 |
2/2✓ Branch 0 taken 126 times.
✓ Branch 1 taken 288 times.
|
414 | if(compatrule_version < 62) |
| 3584 | 288 | set_qr(qr_OLD_BROKEN_WARPEX_MUSIC,1); | |
| 3585 |
2/2✓ Branch 0 taken 126 times.
✓ Branch 1 taken 288 times.
|
414 | if(compatrule_version < 63) |
| 3586 | { | ||
| 3587 | 288 | set_qr(qr_BROKEN_LIFTSWIM,1); | |
| 3588 | 288 | set_qr(qr_BROKEN_GENERIC_PUSHBLOCK_LOCKING,1); | |
| 3589 | 288 | } | |
| 3590 |
2/2✓ Branch 0 taken 126 times.
✓ Branch 1 taken 288 times.
|
414 | if(compatrule_version < 64) |
| 3591 | 288 | set_qr(qr_BROKEN_FLAME_ARROW_REFLECTING,1); | |
| 3592 |
2/2✓ Branch 0 taken 102 times.
✓ Branch 1 taken 312 times.
|
414 | if(compatrule_version < 65) |
| 3593 | 312 | set_qr(qr_BROKEN_SIDEVIEW_SPRITE_JUMP,1); | |
| 3594 |
2/2✓ Branch 0 taken 102 times.
✓ Branch 1 taken 312 times.
|
414 | if(compatrule_version < 66) |
| 3595 | 312 | set_qr(qr_NEWDARK_TRANS_STACKING,1); | |
| 3596 |
2/2✓ Branch 0 taken 102 times.
✓ Branch 1 taken 312 times.
|
414 | if(compatrule_version < 67) |
| 3597 | 312 | set_qr(qr_OLD_HERO_WARP_RETSQUARE,1); | |
| 3598 |
2/2✓ Branch 0 taken 102 times.
✓ Branch 1 taken 312 times.
|
414 | if(compatrule_version < 68) |
| 3599 | 312 | set_qr(qr_SCRIPTS_6_BIT_COLOR,1); | |
| 3600 |
2/2✓ Branch 0 taken 102 times.
✓ Branch 1 taken 312 times.
|
414 | if(compatrule_version < 69) |
| 3601 | 312 | set_qr(qr_SETENEMYWEAPONSOUNDSONWPNCHANGE, 1); | |
| 3602 | |||
| 3603 | 414 | set_qr(qr_ANIMATECUSTOMWEAPONS,0); | |
| 3604 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 271 times.
|
414 | if (s_version < 16) |
| 3605 | 271 | set_qr(qr_BROKEN_HORIZONTAL_WEAPON_ANIM,1); | |
| 3606 | |||
| 3607 | 414 | memcpy(Header, &tempheader, sizeof(tempheader)); | |
| 3608 | |||
| 3609 | 414 | return 0; | |
| 3610 | 414 | } | |
| 3611 | |||
| 3612 | 3527764 | void init_msgstr(MsgStr *str) | |
| 3613 | { | ||
| 3614 | 3527764 | str->s = ""; | |
| 3615 | 3527764 | str->s.shrink_to_fit(); | |
| 3616 | 3527764 | str->nextstring=0; | |
| 3617 | 3527764 | str->tile=0; | |
| 3618 | 3527764 | str->cset=0; | |
| 3619 | 3527764 | str->trans=false; | |
| 3620 | 3527764 | str->font=font_zfont; | |
| 3621 | 3527764 | str->y=32; | |
| 3622 | 3527764 | str->sfx=18; | |
| 3623 | 3527764 | str->listpos=0; | |
| 3624 | 3527764 | str->x=24; | |
| 3625 | 3527764 | str->w=get_qr(qr_STRING_FRAME_OLD_WIDTH_HEIGHT)!=0 ? 24*8 : 26*8; | |
| 3626 | 3527764 | str->h=get_qr(qr_STRING_FRAME_OLD_WIDTH_HEIGHT)!=0 ? 3*8 : 5*8; | |
| 3627 | 3527764 | str->hspace=0; | |
| 3628 | 3527764 | str->vspace=0; | |
| 3629 | 3527764 | str->stringflags=0; | |
| 3630 | 3527764 | str->margins[up] = 8; | |
| 3631 | 3527764 | str->margins[down] = 0; | |
| 3632 | 3527764 | str->margins[left] = 8; | |
| 3633 | 3527764 | str->margins[right] = 8; | |
| 3634 | 3527764 | str->portrait_tile = 0; | |
| 3635 | 3527764 | str->portrait_cset = 0; | |
| 3636 | 3527764 | str->portrait_x = 0; | |
| 3637 | 3527764 | str->portrait_y = 0; | |
| 3638 | 3527764 | str->portrait_tw = 1; | |
| 3639 | 3527764 | str->portrait_th = 1; | |
| 3640 | 3527764 | str->shadow_type = 0; | |
| 3641 | 3527764 | str->shadow_color = 0; | |
| 3642 | 3527764 | str->drawlayer = 6; | |
| 3643 | 3527764 | } | |
| 3644 | |||
| 3645 | 414 | void init_msgstrings(int32_t start, int32_t end) | |
| 3646 | { | ||
| 3647 |
2/4✓ Branch 0 taken 414 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 414 times.
|
414 | if(end <= start || end-start > msg_strings_size) |
| 3648 | ✗ | return; | |
| 3649 | |||
| 3650 |
2/2✓ Branch 0 taken 3391488 times.
✓ Branch 1 taken 414 times.
|
3391902 | for(int32_t i=start; i<end; i++) |
| 3651 | { | ||
| 3652 | 3391488 | init_msgstr(&MsgStrings[i]); | |
| 3653 | 3391488 | MsgStrings[i].listpos=i; | |
| 3654 | 3391488 | } | |
| 3655 | |||
| 3656 |
1/2✓ Branch 0 taken 414 times.
✗ Branch 1 not taken.
|
414 | if(start==0) |
| 3657 | { | ||
| 3658 | 414 | MsgStrings[0].s = "(None)"; | |
| 3659 | 414 | MsgStrings[0].listpos = 0; | |
| 3660 | 414 | } | |
| 3661 | 414 | } | |
| 3662 | |||
| 3663 | 415 | int32_t readstrings(PACKFILE *f, zquestheader *Header) | |
| 3664 | { | ||
| 3665 |
2/2✓ Branch 0 taken 391 times.
✓ Branch 1 taken 24 times.
|
415 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_strings); |
| 3666 | |||
| 3667 | 415 | MsgStr tempMsgString; | |
| 3668 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | init_msgstr(&tempMsgString); |
| 3669 | |||
| 3670 | 415 | word temp_msg_count=0; | |
| 3671 | word temp_expansion[16]; | ||
| 3672 | 415 | memset(temp_expansion, 0, 16*sizeof(word)); | |
| 3673 | 415 | char buf[8193] = {0}; | |
| 3674 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 391 times.
|
415 | if(Header->zelda_version < 0x193) |
| 3675 | { | ||
| 3676 | byte tempbyte; | ||
| 3677 | 24 | int32_t strings_to_read=0; | |
| 3678 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 1 times.
|
24 | if (!should_skip) |
| 3679 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | set_qr(qr_OLD_STRING_EDITOR_MARGINS,true); |
| 3680 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
30 | if((Header->zelda_version < 0x192)|| |
| 3681 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | ((Header->zelda_version == 0x192)&&(Header->build<31))) |
| 3682 | { | ||
| 3683 | 18 | strings_to_read=128; | |
| 3684 | 18 | temp_msg_count=Header->old_str_count; | |
| 3685 | |||
| 3686 | // Some sort of string count corruption seems to be common in old quests | ||
| 3687 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(temp_msg_count>128) |
| 3688 | { | ||
| 3689 | ✗ | temp_msg_count=128; | |
| 3690 | ✗ | } | |
| 3691 | 18 | } | |
| 3692 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | else if((Header->zelda_version == 0x192)&&(Header->build<140)) |
| 3693 | { | ||
| 3694 | ✗ | strings_to_read=255; | |
| 3695 | ✗ | temp_msg_count=Header->old_str_count; | |
| 3696 | ✗ | } | |
| 3697 | else | ||
| 3698 | { | ||
| 3699 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | if(!p_igetw(&temp_msg_count,f)) |
| 3700 | { | ||
| 3701 | ✗ | return qe_invalid; | |
| 3702 | } | ||
| 3703 | |||
| 3704 | 6 | strings_to_read=temp_msg_count; | |
| 3705 | |||
| 3706 |
3/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
|
6 | if (!should_skip && temp_msg_count >= msg_strings_size) |
| 3707 | { | ||
| 3708 | ✗ | Z_message("Reallocating string buffer...\n"); | |
| 3709 | |||
| 3710 | // if((MsgStrings=(MsgStr*)_al_sane_realloc(MsgStrings,sizeof(MsgStr)*MAXMSGS))==NULL) | ||
| 3711 | // return qe_nomem; | ||
| 3712 | |||
| 3713 | //memset(MsgStrings, 0, sizeof(MsgStr)*MAXMSGS); | ||
| 3714 | ✗ | delete[] MsgStrings; | |
| 3715 | ✗ | MsgStrings = new MsgStr[MAXMSGS]; | |
| 3716 | ✗ | msg_strings_size = MAXMSGS; | |
| 3717 | ✗ | for(auto q = 0; q < msg_strings_size; ++q) | |
| 3718 | { | ||
| 3719 | ✗ | MsgStrings[q].clear(); | |
| 3720 | ✗ | } | |
| 3721 | ✗ | } | |
| 3722 | } | ||
| 3723 | |||
| 3724 | //reset the message strings | ||
| 3725 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 1 times.
|
24 | if (!should_skip) |
| 3726 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | init_msgstrings(0,msg_strings_size); |
| 3727 | |||
| 3728 |
2/2✓ Branch 0 taken 2550 times.
✓ Branch 1 taken 24 times.
|
2574 | for(int32_t x=0; x<strings_to_read; x++) |
| 3729 | { | ||
| 3730 |
1/2✓ Branch 0 taken 2550 times.
✗ Branch 1 not taken.
|
2550 | init_msgstr(&tempMsgString); |
| 3731 | 2550 | tempMsgString.listpos = x; | |
| 3732 | |||
| 3733 |
2/4✓ Branch 0 taken 2550 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2550 times.
✗ Branch 3 not taken.
|
2550 | if(!pfread(buf,73,f)) |
| 3734 | { | ||
| 3735 | ✗ | return qe_invalid; | |
| 3736 | } | ||
| 3737 | |||
| 3738 | 2550 | buf[74] = '\0'; | |
| 3739 |
1/2✓ Branch 0 taken 2550 times.
✗ Branch 1 not taken.
|
2550 | tempMsgString.s = buf; |
| 3740 | |||
| 3741 |
2/4✓ Branch 0 taken 2550 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2550 times.
✗ Branch 3 not taken.
|
2550 | if(!p_getc(&tempbyte,f)) |
| 3742 | { | ||
| 3743 | ✗ | return qe_invalid; | |
| 3744 | } | ||
| 3745 | |||
| 3746 |
3/4✓ Branch 0 taken 246 times.
✓ Branch 1 taken 2304 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 246 times.
|
2796 | if((Header->zelda_version < 0x192)|| |
| 3747 |
1/2✓ Branch 0 taken 246 times.
✗ Branch 1 not taken.
|
246 | ((Header->zelda_version == 0x192)&&(Header->build<148))) |
| 3748 | { | ||
| 3749 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2304 times.
|
2304 | tempMsgString.nextstring=tempbyte?x+1:0; |
| 3750 | |||
| 3751 |
2/4✓ Branch 0 taken 2304 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2304 times.
✗ Branch 3 not taken.
|
2304 | if(!p_getc(&tempbyte,f)) |
| 3752 | { | ||
| 3753 | ✗ | return qe_invalid; | |
| 3754 | } | ||
| 3755 | |||
| 3756 |
2/4✓ Branch 0 taken 2304 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2304 times.
✗ Branch 3 not taken.
|
2304 | if(!p_getc(&tempbyte,f)) |
| 3757 | { | ||
| 3758 | ✗ | return qe_invalid; | |
| 3759 | } | ||
| 3760 | 2304 | } | |
| 3761 | else | ||
| 3762 | { | ||
| 3763 |
2/4✓ Branch 0 taken 246 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 246 times.
✗ Branch 3 not taken.
|
246 | if(!p_igetw(&tempMsgString.nextstring,f)) |
| 3764 | { | ||
| 3765 | ✗ | return qe_invalid; | |
| 3766 | } | ||
| 3767 | |||
| 3768 |
2/4✓ Branch 0 taken 246 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 246 times.
✗ Branch 3 not taken.
|
246 | if(!pfread(temp_expansion,32,f)) |
| 3769 | { | ||
| 3770 | ✗ | return qe_invalid; | |
| 3771 | } | ||
| 3772 | } | ||
| 3773 | |||
| 3774 |
2/2✓ Branch 0 taken 2549 times.
✓ Branch 1 taken 1 times.
|
2550 | if (!should_skip) |
| 3775 |
1/2✓ Branch 0 taken 2549 times.
✗ Branch 1 not taken.
|
2549 | MsgStrings[x] = tempMsgString; |
| 3776 | 2550 | } | |
| 3777 | 24 | } | |
| 3778 | else | ||
| 3779 | { | ||
| 3780 | int32_t dummy_int; | ||
| 3781 | word s_version; | ||
| 3782 | word s_cversion; | ||
| 3783 | |||
| 3784 | //section version info | ||
| 3785 |
2/4✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 391 times.
✗ Branch 3 not taken.
|
391 | if(!p_igetw(&s_version,f)) |
| 3786 | { | ||
| 3787 | ✗ | return qe_invalid; | |
| 3788 | } | ||
| 3789 | |||
| 3790 | 391 | FFCore.quest_format[vStrings] = s_version; | |
| 3791 | |||
| 3792 |
2/4✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 391 times.
✗ Branch 3 not taken.
|
391 | if(!p_igetw(&s_cversion,f)) |
| 3793 | { | ||
| 3794 | ✗ | return qe_invalid; | |
| 3795 | } | ||
| 3796 | |||
| 3797 | //section size | ||
| 3798 |
2/4✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 391 times.
✗ Branch 3 not taken.
|
391 | if(!p_igetl(&dummy_int,f)) |
| 3799 | { | ||
| 3800 | ✗ | return qe_invalid; | |
| 3801 | } | ||
| 3802 | |||
| 3803 | //finally... section data | ||
| 3804 |
2/4✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 391 times.
✗ Branch 3 not taken.
|
391 | if(!p_igetw(&temp_msg_count,f)) |
| 3805 | { | ||
| 3806 | ✗ | return qe_invalid; | |
| 3807 | } | ||
| 3808 | |||
| 3809 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
|
391 | if(temp_msg_count >= msg_strings_size) |
| 3810 | { | ||
| 3811 | ✗ | Z_message("Reallocating string buffer...\n"); | |
| 3812 | |||
| 3813 | // if((MsgStrings=(MsgStr*)_al_sane_realloc(MsgStrings,sizeof(MsgStr)*MAXMSGS))==NULL) | ||
| 3814 | // return qe_nomem; | ||
| 3815 | ✗ | delete[] MsgStrings; | |
| 3816 | ✗ | MsgStrings = new MsgStr[MAXMSGS]; | |
| 3817 | ✗ | msg_strings_size = MAXMSGS; | |
| 3818 | ✗ | for(auto q = 0; q < msg_strings_size; ++q) | |
| 3819 | { | ||
| 3820 | ✗ | MsgStrings[q].clear(); | |
| 3821 | ✗ | } | |
| 3822 | //memset(MsgStrings, 0, sizeof(MsgStr)*MAXMSGS); | ||
| 3823 | ✗ | } | |
| 3824 | |||
| 3825 | //reset the message strings | ||
| 3826 |
2/2✓ Branch 0 taken 248 times.
✓ Branch 1 taken 143 times.
|
391 | if(s_version < 7) |
| 3827 |
1/2✓ Branch 0 taken 248 times.
✗ Branch 1 not taken.
|
248 | set_qr(qr_OLD_STRING_EDITOR_MARGINS,true); |
| 3828 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | init_msgstrings(0,msg_strings_size); |
| 3829 | |||
| 3830 | 391 | int32_t string_length=(s_version<2)?73:145; | |
| 3831 | |||
| 3832 |
2/2✓ Branch 0 taken 133311 times.
✓ Branch 1 taken 391 times.
|
133702 | for(int32_t i=0; i<temp_msg_count; i++) |
| 3833 | { | ||
| 3834 |
1/2✓ Branch 0 taken 133311 times.
✗ Branch 1 not taken.
|
133311 | init_msgstr(&tempMsgString); |
| 3835 | 133311 | tempMsgString.listpos = i; | |
| 3836 |
2/2✓ Branch 0 taken 5117 times.
✓ Branch 1 taken 128194 times.
|
133311 | if(s_version > 8) |
| 3837 | { | ||
| 3838 |
2/4✓ Branch 0 taken 5117 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5117 times.
✗ Branch 3 not taken.
|
5117 | if(!p_igetl(&string_length,f)) |
| 3839 | { | ||
| 3840 | ✗ | return qe_invalid; | |
| 3841 | } | ||
| 3842 | 5117 | } | |
| 3843 | |||
| 3844 |
2/4✓ Branch 0 taken 133311 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 133311 times.
|
133311 | if (string_length < 0 || string_length > 8193) |
| 3845 | { | ||
| 3846 | ✗ | return qe_invalid; | |
| 3847 | } | ||
| 3848 | |||
| 3849 |
2/2✓ Branch 0 taken 132789 times.
✓ Branch 1 taken 522 times.
|
133311 | if (string_length > 0) |
| 3850 | { | ||
| 3851 |
2/4✓ Branch 0 taken 132789 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 132789 times.
✗ Branch 3 not taken.
|
132789 | if (!pfread(buf, string_length, f)) |
| 3852 | { | ||
| 3853 | ✗ | return qe_invalid; | |
| 3854 | } | ||
| 3855 | 132789 | } | |
| 3856 | else | ||
| 3857 | { | ||
| 3858 | 522 | buf[0] = 0; | |
| 3859 | } | ||
| 3860 | |||
| 3861 |
2/4✓ Branch 0 taken 133311 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 133311 times.
✗ Branch 3 not taken.
|
133311 | if(!p_igetw(&tempMsgString.nextstring,f)) |
| 3862 | { | ||
| 3863 | ✗ | return qe_invalid; | |
| 3864 | } | ||
| 3865 | |||
| 3866 |
2/2✓ Branch 0 taken 33613 times.
✓ Branch 1 taken 99698 times.
|
133311 | if(s_version<2) |
| 3867 | { | ||
| 3868 | 33613 | buf[72] = '\0'; | |
| 3869 |
1/2✓ Branch 0 taken 33613 times.
✗ Branch 1 not taken.
|
33613 | tempMsgString.s = buf; |
| 3870 | 33613 | } | |
| 3871 | else | ||
| 3872 | { | ||
| 3873 | // June 2008: A bug corrupted the last 4 chars of a string. | ||
| 3874 | // Discard these. | ||
| 3875 |
1/2✓ Branch 0 taken 99698 times.
✗ Branch 1 not taken.
|
99698 | if(s_version<3) |
| 3876 | { | ||
| 3877 | ✗ | for(int32_t j=140; j<144; j++) | |
| 3878 | { | ||
| 3879 | ✗ | buf[j] = '\0'; | |
| 3880 | ✗ | } | |
| 3881 | ✗ | } | |
| 3882 |
1/2✓ Branch 0 taken 99698 times.
✗ Branch 1 not taken.
|
99698 | if(string_length > 8192) string_length = 8192; |
| 3883 | 99698 | buf[string_length]='\0'; //Force-terminate | |
| 3884 |
1/2✓ Branch 0 taken 99698 times.
✗ Branch 1 not taken.
|
99698 | tempMsgString.s = buf; |
| 3885 | |||
| 3886 |
2/2✓ Branch 0 taken 5117 times.
✓ Branch 1 taken 94581 times.
|
99698 | if ( s_version >= 6 ) |
| 3887 | { | ||
| 3888 |
2/4✓ Branch 0 taken 5117 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5117 times.
✗ Branch 3 not taken.
|
5117 | if(!p_igetl(&tempMsgString.tile,f)) |
| 3889 | { | ||
| 3890 | ✗ | return qe_invalid; | |
| 3891 | } | ||
| 3892 | 5117 | } | |
| 3893 | else | ||
| 3894 | { | ||
| 3895 |
2/4✓ Branch 0 taken 94581 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 94581 times.
✗ Branch 3 not taken.
|
94581 | if(!p_igetw(&tempMsgString.tile,f)) |
| 3896 | { | ||
| 3897 | ✗ | return qe_invalid; | |
| 3898 | } | ||
| 3899 | } | ||
| 3900 | |||
| 3901 |
2/4✓ Branch 0 taken 99698 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 99698 times.
✗ Branch 3 not taken.
|
99698 | if(!p_getc(&tempMsgString.cset,f)) |
| 3902 | { | ||
| 3903 | ✗ | return qe_invalid; | |
| 3904 | } | ||
| 3905 | |||
| 3906 | byte dummy_char; | ||
| 3907 | |||
| 3908 |
2/4✓ Branch 0 taken 99698 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 99698 times.
✗ Branch 3 not taken.
|
99698 | if(!p_getc(&dummy_char,f)) // trans is stored as a char... |
| 3909 | { | ||
| 3910 | ✗ | return qe_invalid; | |
| 3911 | } | ||
| 3912 | |||
| 3913 | 99698 | tempMsgString.trans=dummy_char!=0; | |
| 3914 | |||
| 3915 |
2/4✓ Branch 0 taken 99698 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 99698 times.
✗ Branch 3 not taken.
|
99698 | if(!p_getc(&tempMsgString.font,f)) |
| 3916 | { | ||
| 3917 | ✗ | return qe_invalid; | |
| 3918 | } | ||
| 3919 | |||
| 3920 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 99698 times.
|
99698 | if(s_version < 5) |
| 3921 | { | ||
| 3922 | ✗ | if(!p_getc(&tempMsgString.y,f)) | |
| 3923 | { | ||
| 3924 | ✗ | return qe_invalid; | |
| 3925 | } | ||
| 3926 | ✗ | } | |
| 3927 | else | ||
| 3928 | { | ||
| 3929 |
2/4✓ Branch 0 taken 99698 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 99698 times.
✗ Branch 3 not taken.
|
99698 | if(!p_igetw(&tempMsgString.x,f)) |
| 3930 | { | ||
| 3931 | ✗ | return qe_invalid; | |
| 3932 | } | ||
| 3933 | |||
| 3934 |
2/4✓ Branch 0 taken 99698 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 99698 times.
✗ Branch 3 not taken.
|
99698 | if(!p_igetw(&tempMsgString.y,f)) |
| 3935 | { | ||
| 3936 | ✗ | return qe_invalid; | |
| 3937 | } | ||
| 3938 | |||
| 3939 |
2/4✓ Branch 0 taken 99698 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 99698 times.
✗ Branch 3 not taken.
|
99698 | if(!p_igetw(&tempMsgString.w,f)) |
| 3940 | { | ||
| 3941 | ✗ | return qe_invalid; | |
| 3942 | } | ||
| 3943 | |||
| 3944 |
2/4✓ Branch 0 taken 99698 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 99698 times.
✗ Branch 3 not taken.
|
99698 | if(!p_igetw(&tempMsgString.h,f)) |
| 3945 | { | ||
| 3946 | ✗ | return qe_invalid; | |
| 3947 | } | ||
| 3948 | |||
| 3949 |
2/4✓ Branch 0 taken 99698 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 99698 times.
✗ Branch 3 not taken.
|
99698 | if(!p_getc(&tempMsgString.hspace,f)) |
| 3950 | { | ||
| 3951 | ✗ | return qe_invalid; | |
| 3952 | } | ||
| 3953 | |||
| 3954 |
2/4✓ Branch 0 taken 99698 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 99698 times.
✗ Branch 3 not taken.
|
99698 | if(!p_getc(&tempMsgString.vspace,f)) |
| 3955 | { | ||
| 3956 | ✗ | return qe_invalid; | |
| 3957 | } | ||
| 3958 | |||
| 3959 |
2/4✓ Branch 0 taken 99698 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 99698 times.
✗ Branch 3 not taken.
|
99698 | if(!p_getc(&tempMsgString.stringflags,f)) |
| 3960 | { | ||
| 3961 | ✗ | return qe_invalid; | |
| 3962 | } | ||
| 3963 | } | ||
| 3964 | |||
| 3965 |
2/2✓ Branch 0 taken 94581 times.
✓ Branch 1 taken 5117 times.
|
99698 | if(s_version >= 7) |
| 3966 | { | ||
| 3967 |
2/2✓ Branch 0 taken 5117 times.
✓ Branch 1 taken 20468 times.
|
25585 | for(int32_t q = 0; q < 4; ++q) |
| 3968 | { | ||
| 3969 |
2/4✓ Branch 0 taken 20468 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 20468 times.
✗ Branch 3 not taken.
|
20468 | if(!p_getc(&tempMsgString.margins[q],f)) |
| 3970 | { | ||
| 3971 | ✗ | return qe_invalid; | |
| 3972 | } | ||
| 3973 | 20468 | } | |
| 3974 | |||
| 3975 |
2/4✓ Branch 0 taken 5117 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5117 times.
✗ Branch 3 not taken.
|
5117 | if(!p_igetl(&tempMsgString.portrait_tile,f)) |
| 3976 | { | ||
| 3977 | ✗ | return qe_invalid; | |
| 3978 | } | ||
| 3979 | |||
| 3980 |
2/4✓ Branch 0 taken 5117 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5117 times.
✗ Branch 3 not taken.
|
5117 | if(!p_getc(&tempMsgString.portrait_cset,f)) |
| 3981 | { | ||
| 3982 | ✗ | return qe_invalid; | |
| 3983 | } | ||
| 3984 | |||
| 3985 |
2/4✓ Branch 0 taken 5117 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5117 times.
✗ Branch 3 not taken.
|
5117 | if(!p_getc(&tempMsgString.portrait_x,f)) |
| 3986 | { | ||
| 3987 | ✗ | return qe_invalid; | |
| 3988 | } | ||
| 3989 | |||
| 3990 |
2/4✓ Branch 0 taken 5117 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5117 times.
✗ Branch 3 not taken.
|
5117 | if(!p_getc(&tempMsgString.portrait_y,f)) |
| 3991 | { | ||
| 3992 | ✗ | return qe_invalid; | |
| 3993 | } | ||
| 3994 | |||
| 3995 |
2/4✓ Branch 0 taken 5117 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5117 times.
✗ Branch 3 not taken.
|
5117 | if(!p_getc(&tempMsgString.portrait_tw,f)) |
| 3996 | { | ||
| 3997 | ✗ | return qe_invalid; | |
| 3998 | } | ||
| 3999 | |||
| 4000 |
2/4✓ Branch 0 taken 5117 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5117 times.
✗ Branch 3 not taken.
|
5117 | if(!p_getc(&tempMsgString.portrait_th,f)) |
| 4001 | { | ||
| 4002 | ✗ | return qe_invalid; | |
| 4003 | } | ||
| 4004 | 5117 | } | |
| 4005 | |||
| 4006 |
2/2✓ Branch 0 taken 5117 times.
✓ Branch 1 taken 94581 times.
|
99698 | if(s_version >= 8) |
| 4007 | { | ||
| 4008 |
2/4✓ Branch 0 taken 5117 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5117 times.
✗ Branch 3 not taken.
|
5117 | if(!p_getc(&tempMsgString.shadow_type,f)) |
| 4009 | { | ||
| 4010 | ✗ | return qe_invalid; | |
| 4011 | } | ||
| 4012 | |||
| 4013 |
2/4✓ Branch 0 taken 5117 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5117 times.
✗ Branch 3 not taken.
|
5117 | if(!p_getc(&tempMsgString.shadow_color,f)) |
| 4014 | { | ||
| 4015 | ✗ | return qe_invalid; | |
| 4016 | } | ||
| 4017 | 5117 | } | |
| 4018 | |||
| 4019 |
2/2✓ Branch 0 taken 4808 times.
✓ Branch 1 taken 94890 times.
|
99698 | if(s_version >= 10) |
| 4020 | { | ||
| 4021 |
2/4✓ Branch 0 taken 4808 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4808 times.
✗ Branch 3 not taken.
|
4808 | if(!p_getc(&tempMsgString.drawlayer,f)) |
| 4022 | { | ||
| 4023 | ✗ | return qe_invalid; | |
| 4024 | } | ||
| 4025 | 4808 | } | |
| 4026 | |||
| 4027 |
2/4✓ Branch 0 taken 99698 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 99698 times.
✗ Branch 3 not taken.
|
99698 | if(!p_getc(&tempMsgString.sfx,f)) |
| 4028 | { | ||
| 4029 | ✗ | return qe_invalid; | |
| 4030 | } | ||
| 4031 | |||
| 4032 |
1/2✓ Branch 0 taken 99698 times.
✗ Branch 1 not taken.
|
99698 | if(s_version>3) |
| 4033 | { | ||
| 4034 |
2/4✓ Branch 0 taken 99698 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 99698 times.
✗ Branch 3 not taken.
|
99698 | if(!p_igetw(&tempMsgString.listpos,f)) |
| 4035 | { | ||
| 4036 | ✗ | return qe_invalid; | |
| 4037 | } | ||
| 4038 | 99698 | } | |
| 4039 | } | ||
| 4040 | |||
| 4041 |
1/2✓ Branch 0 taken 133311 times.
✗ Branch 1 not taken.
|
133311 | MsgStrings[i].copyAll(tempMsgString); |
| 4042 | 133311 | } | |
| 4043 | } | ||
| 4044 | |||
| 4045 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 414 times.
|
415 | if (!should_skip) |
| 4046 | 414 | msg_count=temp_msg_count; | |
| 4047 | |||
| 4048 | 415 | return 0; | |
| 4049 | 415 | } | |
| 4050 | |||
| 4051 | 415 | int32_t readdoorcombosets(PACKFILE *f, zquestheader *Header) | |
| 4052 | { | ||
| 4053 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 391 times.
|
415 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_doors); |
| 4054 | |||
| 4055 |
3/4✓ Branch 0 taken 397 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
421 | if((Header->zelda_version < 0x192)|| |
| 4056 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 391 times.
|
397 | ((Header->zelda_version == 0x192)&&(Header->build<158))) |
| 4057 | { | ||
| 4058 | 18 | return 0; | |
| 4059 | } | ||
| 4060 | |||
| 4061 | 397 | word temp_door_combo_set_count=0; | |
| 4062 | DoorComboSet tempDoorComboSet; | ||
| 4063 | word dummy_word; | ||
| 4064 | int32_t dummy_long; | ||
| 4065 | byte padding; | ||
| 4066 | 397 | int32_t s_version = 0; | |
| 4067 | |||
| 4068 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 396 times.
|
397 | if (!should_skip) |
| 4069 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 396 times.
|
101772 | for(int32_t i=0; i<MAXDOORCOMBOSETS; i++) |
| 4070 | { | ||
| 4071 | 101376 | memset(DoorComboSets+i, 0, sizeof(DoorComboSet)); | |
| 4072 | 101772 | } | |
| 4073 | |||
| 4074 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 391 times.
|
397 | if(Header->zelda_version > 0x192) |
| 4075 | { | ||
| 4076 | //section version info | ||
| 4077 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | if(!p_igetw(&s_version,f)) |
| 4078 | { | ||
| 4079 | ✗ | return qe_invalid; | |
| 4080 | } | ||
| 4081 | |||
| 4082 | 391 | FFCore.quest_format[vDoors] = s_version; | |
| 4083 | |||
| 4084 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | if(!p_igetw(&dummy_word,f)) |
| 4085 | { | ||
| 4086 | ✗ | return qe_invalid; | |
| 4087 | } | ||
| 4088 | |||
| 4089 | //section size | ||
| 4090 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | if(!p_igetl(&dummy_long,f)) |
| 4091 | { | ||
| 4092 | ✗ | return qe_invalid; | |
| 4093 | } | ||
| 4094 | 391 | } | |
| 4095 | |||
| 4096 | //finally... section data | ||
| 4097 |
1/2✓ Branch 0 taken 397 times.
✗ Branch 1 not taken.
|
397 | if(!p_igetw(&temp_door_combo_set_count,f)) |
| 4098 | { | ||
| 4099 | ✗ | return qe_invalid; | |
| 4100 | } | ||
| 4101 | |||
| 4102 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 397 times.
|
397 | if (temp_door_combo_set_count > MAXDOORCOMBOSETS) |
| 4103 | { | ||
| 4104 | ✗ | return qe_invalid; | |
| 4105 | } | ||
| 4106 | |||
| 4107 |
2/2✓ Branch 0 taken 3697 times.
✓ Branch 1 taken 397 times.
|
4094 | for(int32_t i=0; i<temp_door_combo_set_count; i++) |
| 4108 | { | ||
| 4109 | 3697 | memset(&tempDoorComboSet, 0, sizeof(DoorComboSet)); | |
| 4110 | |||
| 4111 | //name | ||
| 4112 |
1/2✓ Branch 0 taken 3697 times.
✗ Branch 1 not taken.
|
3697 | if(!pfread(&tempDoorComboSet.name,sizeof(tempDoorComboSet.name),f)) |
| 4113 | { | ||
| 4114 | ✗ | return qe_invalid; | |
| 4115 | } | ||
| 4116 | |||
| 4117 |
2/2✓ Branch 0 taken 3657 times.
✓ Branch 1 taken 40 times.
|
3697 | if(Header->zelda_version < 0x193) |
| 4118 | { | ||
| 4119 |
1/2✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
|
40 | if(!p_getc(&padding,f)) |
| 4120 | { | ||
| 4121 | ✗ | return qe_invalid; | |
| 4122 | } | ||
| 4123 | 40 | } | |
| 4124 | |||
| 4125 | //up door | ||
| 4126 |
2/2✓ Branch 0 taken 33273 times.
✓ Branch 1 taken 3697 times.
|
36970 | for(int32_t j=0; j<9; j++) |
| 4127 | { | ||
| 4128 |
2/2✓ Branch 0 taken 133092 times.
✓ Branch 1 taken 33273 times.
|
166365 | for(int32_t k=0; k<4; k++) |
| 4129 | { | ||
| 4130 |
1/2✓ Branch 0 taken 133092 times.
✗ Branch 1 not taken.
|
133092 | if(!p_igetw(&tempDoorComboSet.doorcombo_u[j][k],f)) |
| 4131 | { | ||
| 4132 | ✗ | return qe_invalid; | |
| 4133 | } | ||
| 4134 | 133092 | } | |
| 4135 | 33273 | } | |
| 4136 | |||
| 4137 |
2/2✓ Branch 0 taken 33273 times.
✓ Branch 1 taken 3697 times.
|
36970 | for(int32_t j=0; j<9; j++) |
| 4138 | { | ||
| 4139 |
2/2✓ Branch 0 taken 133092 times.
✓ Branch 1 taken 33273 times.
|
166365 | for(int32_t k=0; k<4; k++) |
| 4140 | { | ||
| 4141 |
1/2✓ Branch 0 taken 133092 times.
✗ Branch 1 not taken.
|
133092 | if(!p_getc(&tempDoorComboSet.doorcset_u[j][k],f)) |
| 4142 | { | ||
| 4143 | ✗ | return qe_invalid; | |
| 4144 | } | ||
| 4145 | 133092 | } | |
| 4146 | 33273 | } | |
| 4147 | |||
| 4148 | //down door | ||
| 4149 |
2/2✓ Branch 0 taken 33273 times.
✓ Branch 1 taken 3697 times.
|
36970 | for(int32_t j=0; j<9; j++) |
| 4150 | { | ||
| 4151 |
2/2✓ Branch 0 taken 133092 times.
✓ Branch 1 taken 33273 times.
|
166365 | for(int32_t k=0; k<4; k++) |
| 4152 | { | ||
| 4153 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 133092 times.
|
133092 | if(!p_igetw(&tempDoorComboSet.doorcombo_d[j][k],f)) |
| 4154 | { | ||
| 4155 | ✗ | return qe_invalid; | |
| 4156 | } | ||
| 4157 | 133092 | } | |
| 4158 | 33273 | } | |
| 4159 | |||
| 4160 |
2/2✓ Branch 0 taken 33273 times.
✓ Branch 1 taken 3697 times.
|
36970 | for(int32_t j=0; j<9; j++) |
| 4161 | { | ||
| 4162 |
2/2✓ Branch 0 taken 133092 times.
✓ Branch 1 taken 33273 times.
|
166365 | for(int32_t k=0; k<4; k++) |
| 4163 | { | ||
| 4164 |
1/2✓ Branch 0 taken 133092 times.
✗ Branch 1 not taken.
|
133092 | if(!p_getc(&tempDoorComboSet.doorcset_d[j][k],f)) |
| 4165 | { | ||
| 4166 | ✗ | return qe_invalid; | |
| 4167 | } | ||
| 4168 | 133092 | } | |
| 4169 | 33273 | } | |
| 4170 | |||
| 4171 | //left door | ||
| 4172 |
2/2✓ Branch 0 taken 33273 times.
✓ Branch 1 taken 3697 times.
|
36970 | for(int32_t j=0; j<9; j++) |
| 4173 | { | ||
| 4174 |
2/2✓ Branch 0 taken 199638 times.
✓ Branch 1 taken 33273 times.
|
232911 | for(int32_t k=0; k<6; k++) |
| 4175 | { | ||
| 4176 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 199638 times.
|
199638 | if(!p_igetw(&tempDoorComboSet.doorcombo_l[j][k],f)) |
| 4177 | { | ||
| 4178 | ✗ | return qe_invalid; | |
| 4179 | } | ||
| 4180 | 199638 | } | |
| 4181 | 33273 | } | |
| 4182 | |||
| 4183 |
2/2✓ Branch 0 taken 33273 times.
✓ Branch 1 taken 3697 times.
|
36970 | for(int32_t j=0; j<9; j++) |
| 4184 | { | ||
| 4185 |
2/2✓ Branch 0 taken 199638 times.
✓ Branch 1 taken 33273 times.
|
232911 | for(int32_t k=0; k<6; k++) |
| 4186 | { | ||
| 4187 |
1/2✓ Branch 0 taken 199638 times.
✗ Branch 1 not taken.
|
199638 | if(!p_getc(&tempDoorComboSet.doorcset_l[j][k],f)) |
| 4188 | { | ||
| 4189 | ✗ | return qe_invalid; | |
| 4190 | } | ||
| 4191 | 199638 | } | |
| 4192 | 33273 | } | |
| 4193 | |||
| 4194 | //right door | ||
| 4195 |
2/2✓ Branch 0 taken 33273 times.
✓ Branch 1 taken 3697 times.
|
36970 | for(int32_t j=0; j<9; j++) |
| 4196 | { | ||
| 4197 |
2/2✓ Branch 0 taken 199638 times.
✓ Branch 1 taken 33273 times.
|
232911 | for(int32_t k=0; k<6; k++) |
| 4198 | { | ||
| 4199 |
1/2✓ Branch 0 taken 199638 times.
✗ Branch 1 not taken.
|
199638 | if(!p_igetw(&tempDoorComboSet.doorcombo_r[j][k],f)) |
| 4200 | { | ||
| 4201 | ✗ | return qe_invalid; | |
| 4202 | } | ||
| 4203 | 199638 | } | |
| 4204 | 33273 | } | |
| 4205 | |||
| 4206 |
2/2✓ Branch 0 taken 33273 times.
✓ Branch 1 taken 3697 times.
|
36970 | for(int32_t j=0; j<9; j++) |
| 4207 | { | ||
| 4208 |
2/2✓ Branch 0 taken 199638 times.
✓ Branch 1 taken 33273 times.
|
232911 | for(int32_t k=0; k<6; k++) |
| 4209 | { | ||
| 4210 |
1/2✓ Branch 0 taken 199638 times.
✗ Branch 1 not taken.
|
199638 | if(!p_getc(&tempDoorComboSet.doorcset_r[j][k],f)) |
| 4211 | { | ||
| 4212 | ✗ | return qe_invalid; | |
| 4213 | } | ||
| 4214 | 199638 | } | |
| 4215 | 33273 | } | |
| 4216 | |||
| 4217 | //up bomb rubble | ||
| 4218 |
2/2✓ Branch 0 taken 7394 times.
✓ Branch 1 taken 3697 times.
|
11091 | for(int32_t j=0; j<2; j++) |
| 4219 | { | ||
| 4220 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7394 times.
|
7394 | if(!p_igetw(&tempDoorComboSet.bombdoorcombo_u[j],f)) |
| 4221 | { | ||
| 4222 | ✗ | return qe_invalid; | |
| 4223 | } | ||
| 4224 | 7394 | } | |
| 4225 | |||
| 4226 |
2/2✓ Branch 0 taken 7394 times.
✓ Branch 1 taken 3697 times.
|
11091 | for(int32_t j=0; j<2; j++) |
| 4227 | { | ||
| 4228 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7394 times.
|
7394 | if(!p_getc(&tempDoorComboSet.bombdoorcset_u[j],f)) |
| 4229 | { | ||
| 4230 | ✗ | return qe_invalid; | |
| 4231 | } | ||
| 4232 | 7394 | } | |
| 4233 | |||
| 4234 | //down bomb rubble | ||
| 4235 |
2/2✓ Branch 0 taken 7394 times.
✓ Branch 1 taken 3697 times.
|
11091 | for(int32_t j=0; j<2; j++) |
| 4236 | { | ||
| 4237 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7394 times.
|
7394 | if(!p_igetw(&tempDoorComboSet.bombdoorcombo_d[j],f)) |
| 4238 | { | ||
| 4239 | ✗ | return qe_invalid; | |
| 4240 | } | ||
| 4241 | 7394 | } | |
| 4242 | |||
| 4243 |
2/2✓ Branch 0 taken 7394 times.
✓ Branch 1 taken 3697 times.
|
11091 | for(int32_t j=0; j<2; j++) |
| 4244 | { | ||
| 4245 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7394 times.
|
7394 | if(!p_getc(&tempDoorComboSet.bombdoorcset_d[j],f)) |
| 4246 | { | ||
| 4247 | ✗ | return qe_invalid; | |
| 4248 | } | ||
| 4249 | 7394 | } | |
| 4250 | |||
| 4251 | //left bomb rubble | ||
| 4252 |
2/2✓ Branch 0 taken 11091 times.
✓ Branch 1 taken 3697 times.
|
14788 | for(int32_t j=0; j<3; j++) |
| 4253 | { | ||
| 4254 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11091 times.
|
11091 | if(!p_igetw(&tempDoorComboSet.bombdoorcombo_l[j],f)) |
| 4255 | { | ||
| 4256 | ✗ | return qe_invalid; | |
| 4257 | } | ||
| 4258 | 11091 | } | |
| 4259 | |||
| 4260 |
2/2✓ Branch 0 taken 11091 times.
✓ Branch 1 taken 3697 times.
|
14788 | for(int32_t j=0; j<3; j++) |
| 4261 | { | ||
| 4262 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11091 times.
|
11091 | if(!p_getc(&tempDoorComboSet.bombdoorcset_l[j],f)) |
| 4263 | { | ||
| 4264 | ✗ | return qe_invalid; | |
| 4265 | } | ||
| 4266 | 11091 | } | |
| 4267 | |||
| 4268 |
2/2✓ Branch 0 taken 3657 times.
✓ Branch 1 taken 40 times.
|
3697 | if(Header->zelda_version < 0x193) |
| 4269 | { | ||
| 4270 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | if(!p_getc(&padding,f)) |
| 4271 | { | ||
| 4272 | ✗ | return qe_invalid; | |
| 4273 | } | ||
| 4274 | |||
| 4275 | 40 | } | |
| 4276 | |||
| 4277 | //right bomb rubble | ||
| 4278 |
2/2✓ Branch 0 taken 11091 times.
✓ Branch 1 taken 3697 times.
|
14788 | for(int32_t j=0; j<3; j++) |
| 4279 | { | ||
| 4280 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11091 times.
|
11091 | if(!p_igetw(&tempDoorComboSet.bombdoorcombo_r[j],f)) |
| 4281 | { | ||
| 4282 | ✗ | return qe_invalid; | |
| 4283 | } | ||
| 4284 | 11091 | } | |
| 4285 | |||
| 4286 |
2/2✓ Branch 0 taken 11091 times.
✓ Branch 1 taken 3697 times.
|
14788 | for(int32_t j=0; j<3; j++) |
| 4287 | { | ||
| 4288 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11091 times.
|
11091 | if(!p_getc(&tempDoorComboSet.bombdoorcset_r[j],f)) |
| 4289 | { | ||
| 4290 | ✗ | return qe_invalid; | |
| 4291 | } | ||
| 4292 | 11091 | } | |
| 4293 | |||
| 4294 |
2/2✓ Branch 0 taken 3657 times.
✓ Branch 1 taken 40 times.
|
3697 | if(Header->zelda_version < 0x193) |
| 4295 | { | ||
| 4296 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | if(!p_getc(&padding,f)) |
| 4297 | { | ||
| 4298 | ✗ | return qe_invalid; | |
| 4299 | } | ||
| 4300 | 40 | } | |
| 4301 | |||
| 4302 | //walkthrough stuff | ||
| 4303 |
2/2✓ Branch 0 taken 14788 times.
✓ Branch 1 taken 3697 times.
|
18485 | for(int32_t j=0; j<4; j++) |
| 4304 | { | ||
| 4305 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14788 times.
|
14788 | if(!p_igetw(&tempDoorComboSet.walkthroughcombo[j],f)) |
| 4306 | { | ||
| 4307 | ✗ | return qe_invalid; | |
| 4308 | } | ||
| 4309 | 14788 | } | |
| 4310 | |||
| 4311 |
2/2✓ Branch 0 taken 14788 times.
✓ Branch 1 taken 3697 times.
|
18485 | for(int32_t j=0; j<4; j++) |
| 4312 | { | ||
| 4313 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14788 times.
|
14788 | if(!p_getc(&tempDoorComboSet.walkthroughcset[j],f)) |
| 4314 | { | ||
| 4315 | ✗ | return qe_invalid; | |
| 4316 | } | ||
| 4317 | 14788 | } | |
| 4318 | |||
| 4319 | //flags | ||
| 4320 |
2/2✓ Branch 0 taken 7394 times.
✓ Branch 1 taken 3697 times.
|
11091 | for(int32_t j=0; j<2; j++) |
| 4321 | { | ||
| 4322 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7394 times.
|
7394 | if(!p_getc(&tempDoorComboSet.flags[j],f)) |
| 4323 | { | ||
| 4324 | ✗ | return qe_invalid; | |
| 4325 | } | ||
| 4326 | 7394 | } | |
| 4327 | |||
| 4328 |
2/2✓ Branch 0 taken 3657 times.
✓ Branch 1 taken 40 times.
|
3697 | if(Header->zelda_version < 0x193) |
| 4329 | { | ||
| 4330 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | if(!pfread(&tempDoorComboSet.expansion,sizeof(tempDoorComboSet.expansion),f)) |
| 4331 | { | ||
| 4332 | ✗ | return qe_invalid; | |
| 4333 | } | ||
| 4334 | 40 | } | |
| 4335 | |||
| 4336 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 3683 times.
|
3697 | if (!should_skip) |
| 4337 | 3683 | memcpy(&DoorComboSets[i], &tempDoorComboSet, sizeof(tempDoorComboSet)); | |
| 4338 | 3697 | } | |
| 4339 | |||
| 4340 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 396 times.
|
397 | if (!should_skip) |
| 4341 | 396 | door_combo_set_count=temp_door_combo_set_count; | |
| 4342 | |||
| 4343 | 397 | return 0; | |
| 4344 | 415 | } | |
| 4345 | |||
| 4346 | 6 | int32_t count_dmaps() | |
| 4347 | { | ||
| 4348 | 6 | int32_t i=MAXDMAPS-1; | |
| 4349 | 6 | bool found=false; | |
| 4350 | |||
| 4351 |
4/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 12 times.
✓ Branch 3 taken 6 times.
|
6 | while(i>=0 && !found) |
| 4352 | { | ||
| 4353 |
4/6✓ Branch 0 taken 6 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
18 | if((DMaps[i].map!=0)||(DMaps[i].level!=0)||(DMaps[i].xoff!=0)|| |
| 4354 |
3/6✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
6 | (DMaps[i].compass!=0)||(DMaps[i].color!=0)||(DMaps[i].midi!=0)|| |
| 4355 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | (DMaps[i].cont!=0)||(DMaps[i].type!=0)) |
| 4356 | 12 | found=true; | |
| 4357 | |||
| 4358 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 12 times.
|
60 | for(int32_t j=0; j<8; j++) |
| 4359 | { | ||
| 4360 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
|
48 | if(DMaps[i].grid[j]!=0) |
| 4361 | |||
| 4362 | ✗ | found=true; | |
| 4363 | 48 | } | |
| 4364 | |||
| 4365 |
5/6✓ Branch 0 taken 6 times.
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 6 times.
✓ Branch 5 taken 6 times.
|
12 | if((DMaps[i].name[0]!=0)||(DMaps[i].title[0]!=0)|| |
| 4366 | ✗ | (DMaps[i].intro[0]!=0)||(DMaps[i].tmusic[0]!=0)) | |
| 4367 | 18 | found=true; | |
| 4368 | |||
| 4369 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
18 | if((DMaps[i].minimap_1_tile!=0)||(DMaps[i].minimap_2_tile!=0)|| |
| 4370 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | (DMaps[i].largemap_1_tile!=0)||(DMaps[i].largemap_2_tile!=0)|| |
| 4371 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | (DMaps[i].minimap_1_cset!=0)||(DMaps[i].minimap_2_cset!=0)|| |
| 4372 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | (DMaps[i].largemap_1_cset!=0)||(DMaps[i].largemap_2_cset!=0)) |
| 4373 | 12 | found=true; | |
| 4374 | |||
| 4375 | ✗ | if(!found) | |
| 4376 | { | ||
| 4377 | ✗ | i--; | |
| 4378 | ✗ | } | |
| 4379 | } | ||
| 4380 | |||
| 4381 | 6 | return i+1; | |
| 4382 | } | ||
| 4383 | |||
| 4384 | |||
| 4385 | 6 | int32_t count_shops(miscQdata *Misc) | |
| 4386 | { | ||
| 4387 | 6 | int32_t i=NUM_SHOPS-1,j; | |
| 4388 | 6 | bool found=false; | |
| 4389 | |||
| 4390 |
4/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1480 times.
✓ Branch 2 taken 1476 times.
✓ Branch 3 taken 6 times.
|
1482 | while(i>=0 && !found) |
| 4391 | { | ||
| 4392 | 1476 | j=2; | |
| 4393 | |||
| 4394 |
4/4✓ Branch 0 taken 1472 times.
✓ Branch 1 taken 4424 times.
✓ Branch 2 taken 4420 times.
✓ Branch 3 taken 1476 times.
|
5896 | while(j>=0 && !found) |
| 4395 | { | ||
| 4396 |
3/4✓ Branch 0 taken 4416 times.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4416 times.
|
4420 | if((Misc->shop[i].hasitem[j]!=0)||(Misc->shop[i].price[j]!=0)) |
| 4397 | { | ||
| 4398 | 4 | found=true; | |
| 4399 | 4 | } | |
| 4400 | else | ||
| 4401 | { | ||
| 4402 | 4416 | j--; | |
| 4403 | } | ||
| 4404 | } | ||
| 4405 | |||
| 4406 |
1/2✓ Branch 0 taken 1476 times.
✗ Branch 1 not taken.
|
1476 | if(Misc->shop[i].name[0]!=0) |
| 4407 | { | ||
| 4408 | ✗ | found=true; | |
| 4409 | ✗ | } | |
| 4410 | |||
| 4411 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1472 times.
|
1476 | if(!found) |
| 4412 | { | ||
| 4413 | 1472 | i--; | |
| 4414 | 1472 | } | |
| 4415 | } | ||
| 4416 | |||
| 4417 | 6 | return i+1; | |
| 4418 | } | ||
| 4419 | |||
| 4420 | 6 | int32_t count_infos(miscQdata *Misc) | |
| 4421 | { | ||
| 4422 | 6 | int32_t i=255,j; | |
| 4423 | 6 | bool found=false; | |
| 4424 | |||
| 4425 |
4/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1480 times.
✓ Branch 2 taken 1476 times.
✓ Branch 3 taken 6 times.
|
1482 | while(i>=0 && !found) |
| 4426 | { | ||
| 4427 | 1476 | j=2; | |
| 4428 | |||
| 4429 |
4/4✓ Branch 0 taken 1472 times.
✓ Branch 1 taken 4424 times.
✓ Branch 2 taken 4420 times.
✓ Branch 3 taken 1476 times.
|
5896 | while(j>=0 && !found) |
| 4430 | { | ||
| 4431 |
4/4✓ Branch 0 taken 4419 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 4416 times.
|
4420 | if((Misc->info[i].str[j]!=0)||(Misc->info[i].price[j]!=0)) |
| 4432 | { | ||
| 4433 | 4 | found=true; | |
| 4434 | 4 | } | |
| 4435 | else | ||
| 4436 | { | ||
| 4437 | 4416 | j--; | |
| 4438 | } | ||
| 4439 | } | ||
| 4440 | |||
| 4441 |
1/2✓ Branch 0 taken 1476 times.
✗ Branch 1 not taken.
|
1476 | if(Misc->info[i].name[0]!=0) |
| 4442 | { | ||
| 4443 | ✗ | found=true; | |
| 4444 | ✗ | } | |
| 4445 | |||
| 4446 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1472 times.
|
1476 | if(!found) |
| 4447 | { | ||
| 4448 | 1472 | i--; | |
| 4449 | 1472 | } | |
| 4450 | } | ||
| 4451 | |||
| 4452 | 6 | return i+1; | |
| 4453 | } | ||
| 4454 | |||
| 4455 | 6 | int32_t count_warprings(miscQdata *Misc) | |
| 4456 | { | ||
| 4457 | 6 | int32_t i=15,j; | |
| 4458 | 6 | bool found=false; | |
| 4459 | |||
| 4460 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 36 times.
✓ Branch 2 taken 30 times.
✓ Branch 3 taken 6 times.
|
36 | while(i>=0 && !found) |
| 4461 | { | ||
| 4462 | 30 | j=7; | |
| 4463 | |||
| 4464 |
4/4✓ Branch 0 taken 24 times.
✓ Branch 1 taken 222 times.
✓ Branch 2 taken 216 times.
✓ Branch 3 taken 30 times.
|
246 | while(j>=0 && !found) |
| 4465 | { | ||
| 4466 |
4/4✓ Branch 0 taken 213 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 210 times.
|
216 | if((Misc->warp[i].dmap[j]!=0)||(Misc->warp[i].scr[j]!=0)) |
| 4467 | { | ||
| 4468 | 6 | found=true; | |
| 4469 | 6 | } | |
| 4470 | else | ||
| 4471 | { | ||
| 4472 | 210 | j--; | |
| 4473 | } | ||
| 4474 | } | ||
| 4475 | |||
| 4476 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 24 times.
|
30 | if(!found) |
| 4477 | { | ||
| 4478 | 24 | i--; | |
| 4479 | 24 | } | |
| 4480 | } | ||
| 4481 | |||
| 4482 | 6 | return i+1; | |
| 4483 | } | ||
| 4484 | |||
| 4485 | 6 | int32_t count_palcycles(miscQdata *Misc) | |
| 4486 | { | ||
| 4487 | 6 | int32_t i=255,j; | |
| 4488 | 6 | bool found=false; | |
| 4489 | |||
| 4490 |
4/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1406 times.
✓ Branch 2 taken 1402 times.
✓ Branch 3 taken 6 times.
|
1408 | while(i>=0 && !found) |
| 4491 | { | ||
| 4492 | 1402 | j=2; | |
| 4493 | |||
| 4494 |
4/4✓ Branch 0 taken 1398 times.
✓ Branch 1 taken 4202 times.
✓ Branch 2 taken 4198 times.
✓ Branch 3 taken 1402 times.
|
5600 | while(j>=0 && !found) |
| 4495 | { | ||
| 4496 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4194 times.
|
4198 | if(Misc->cycles[i][j].count!=0) |
| 4497 | { | ||
| 4498 | 4 | found=true; | |
| 4499 | 4 | } | |
| 4500 | else | ||
| 4501 | { | ||
| 4502 | 4194 | j--; | |
| 4503 | } | ||
| 4504 | } | ||
| 4505 | |||
| 4506 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1398 times.
|
1402 | if(!found) |
| 4507 | { | ||
| 4508 | 1398 | i--; | |
| 4509 | 1398 | } | |
| 4510 | } | ||
| 4511 | |||
| 4512 | 6 | return i+1; | |
| 4513 | } | ||
| 4514 | |||
| 4515 | 4631 | void clear_screen(mapscr *temp_scr) | |
| 4516 | { | ||
| 4517 | 4631 | temp_scr->zero_memory(); | |
| 4518 | 4631 | } | |
| 4519 | |||
| 4520 | // NOTE: when modifying this, you need to also update: | ||
| 4521 | // readonedmap, readdmaps, and FFScript::read_dmaps | ||
| 4522 | // (and their associated write functions) | ||
| 4523 | 3487 | int32_t readdmaps(PACKFILE *f, zquestheader *Header, word, word, word start_dmap, word max_dmaps) | |
| 4524 | { | ||
| 4525 |
2/2✓ Branch 0 taken 3463 times.
✓ Branch 1 taken 24 times.
|
3487 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_dmaps); |
| 4526 | |||
| 4527 | 3487 | word dmapstoread=0; | |
| 4528 | 3487 | dmap tempDMap; | |
| 4529 | |||
| 4530 | int32_t dummy; | ||
| 4531 | 3487 | word s_version=0, s_cversion=0; | |
| 4532 | byte padding; | ||
| 4533 | |||
| 4534 | char legacy_title[22]; | ||
| 4535 | |||
| 4536 |
2/2✓ Branch 0 taken 3073 times.
✓ Branch 1 taken 414 times.
|
3487 | if (!should_skip) |
| 4537 |
2/2✓ Branch 0 taken 211968 times.
✓ Branch 1 taken 414 times.
|
212382 | for(int32_t i=0; i<max_dmaps; i++) |
| 4538 | { | ||
| 4539 |
1/2✓ Branch 0 taken 211968 times.
✗ Branch 1 not taken.
|
211968 | DMaps[start_dmap + i].clear(); |
| 4540 | 211968 | sprintf(legacy_title," "); | |
| 4541 | 211968 | sprintf(DMaps[start_dmap+i].intro," "); | |
| 4542 | 211968 | DMaps[start_dmap+i].type |= dmCAVE; | |
| 4543 | 212382 | } | |
| 4544 | |||
| 4545 |
4/4✓ Branch 0 taken 415 times.
✓ Branch 1 taken 3072 times.
✓ Branch 2 taken 391 times.
✓ Branch 3 taken 24 times.
|
3487 | if(!Header || Header->zelda_version > 0x192) |
| 4546 | { | ||
| 4547 | //section version info | ||
| 4548 |
3/4✓ Branch 0 taken 391 times.
✓ Branch 1 taken 3072 times.
✓ Branch 2 taken 391 times.
✗ Branch 3 not taken.
|
3463 | if(!p_igetw(&s_version,f)) |
| 4549 | { | ||
| 4550 | ✗ | return qe_invalid; | |
| 4551 | } | ||
| 4552 | |||
| 4553 | 391 | FFCore.quest_format[vDMaps] = s_version; | |
| 4554 | |||
| 4555 | |||
| 4556 |
2/4✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 391 times.
✗ Branch 3 not taken.
|
391 | if(!p_igetw(&s_cversion,f)) |
| 4557 | { | ||
| 4558 | ✗ | return qe_invalid; | |
| 4559 | } | ||
| 4560 | |||
| 4561 | //section size | ||
| 4562 |
2/4✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 391 times.
✗ Branch 3 not taken.
|
391 | if(!p_igetl(&dummy,f)) |
| 4563 | { | ||
| 4564 | ✗ | return qe_invalid; | |
| 4565 | } | ||
| 4566 | |||
| 4567 | //finally... section data | ||
| 4568 |
2/4✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 391 times.
✗ Branch 3 not taken.
|
391 | if(!p_igetw(&dmapstoread,f)) |
| 4569 | { | ||
| 4570 | ✗ | return qe_invalid; | |
| 4571 | } | ||
| 4572 | 391 | } | |
| 4573 | else | ||
| 4574 | { | ||
| 4575 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
30 | if((Header->zelda_version < 0x192)|| |
| 4576 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | ((Header->zelda_version == 0x192)&&(Header->build<5))) |
| 4577 | { | ||
| 4578 | 18 | dmapstoread=32; | |
| 4579 | 18 | } | |
| 4580 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | else if(s_version <= 4) |
| 4581 | { | ||
| 4582 | 6 | dmapstoread=OLDMAXDMAPS; | |
| 4583 | 6 | } | |
| 4584 | else | ||
| 4585 | { | ||
| 4586 | ✗ | dmapstoread=MAXDMAPS; | |
| 4587 | } | ||
| 4588 | } | ||
| 4589 | |||
| 4590 |
2/2✓ Branch 0 taken 83 times.
✓ Branch 1 taken 332 times.
|
415 | dmapstoread=zc_min(dmapstoread, max_dmaps); |
| 4591 |
2/2✓ Branch 0 taken 83 times.
✓ Branch 1 taken 332 times.
|
415 | dmapstoread=zc_min(dmapstoread, MAXDMAPS-start_dmap); |
| 4592 | |||
| 4593 |
2/2✓ Branch 0 taken 187200 times.
✓ Branch 1 taken 415 times.
|
187615 | for(int32_t i=start_dmap; i<dmapstoread+start_dmap; i++) |
| 4594 | { | ||
| 4595 |
1/2✓ Branch 0 taken 187200 times.
✗ Branch 1 not taken.
|
187200 | tempDMap.clear(); |
| 4596 | 187200 | sprintf(legacy_title," "); | |
| 4597 | 187200 | sprintf(tempDMap.intro," "); | |
| 4598 | |||
| 4599 |
2/4✓ Branch 0 taken 187200 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 187200 times.
✗ Branch 3 not taken.
|
187200 | if(!p_getc(&tempDMap.map,f)) |
| 4600 | { | ||
| 4601 | ✗ | return qe_invalid; | |
| 4602 | } | ||
| 4603 | |||
| 4604 |
2/2✓ Branch 0 taken 17216 times.
✓ Branch 1 taken 169984 times.
|
187200 | if(s_version <= 4) |
| 4605 | { | ||
| 4606 | byte tempbyte; | ||
| 4607 | |||
| 4608 |
2/4✓ Branch 0 taken 17216 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17216 times.
✗ Branch 3 not taken.
|
17216 | if(!p_getc(&tempbyte,f)) |
| 4609 | { | ||
| 4610 | ✗ | return qe_invalid; | |
| 4611 | } | ||
| 4612 | |||
| 4613 | 17216 | tempDMap.level=(word)tempbyte; | |
| 4614 | 17216 | } | |
| 4615 | else | ||
| 4616 | { | ||
| 4617 |
2/4✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 169984 times.
✗ Branch 3 not taken.
|
169984 | if(!p_igetw(&tempDMap.level,f)) |
| 4618 | { | ||
| 4619 | ✗ | return qe_invalid; | |
| 4620 | } | ||
| 4621 | } | ||
| 4622 | |||
| 4623 |
2/4✓ Branch 0 taken 187200 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 187200 times.
✗ Branch 3 not taken.
|
187200 | if(!p_getc(&tempDMap.xoff,f)) |
| 4624 | { | ||
| 4625 | ✗ | return qe_invalid; | |
| 4626 | } | ||
| 4627 | |||
| 4628 |
2/4✓ Branch 0 taken 187200 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 187200 times.
✗ Branch 3 not taken.
|
187200 | if(!p_getc(&tempDMap.compass,f)) |
| 4629 | { | ||
| 4630 | ✗ | return qe_invalid; | |
| 4631 | } | ||
| 4632 | |||
| 4633 |
2/2✓ Branch 0 taken 169984 times.
✓ Branch 1 taken 17216 times.
|
187200 | if(s_version > 8) // February 2009 |
| 4634 | { | ||
| 4635 |
2/4✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 169984 times.
✗ Branch 3 not taken.
|
169984 | if(!p_igetw(&tempDMap.color,f)) |
| 4636 | { | ||
| 4637 | ✗ | return qe_invalid; | |
| 4638 | } | ||
| 4639 | 169984 | } | |
| 4640 | else | ||
| 4641 | { | ||
| 4642 | byte tempbyte; | ||
| 4643 | |||
| 4644 |
2/4✓ Branch 0 taken 17216 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17216 times.
✗ Branch 3 not taken.
|
17216 | if(!p_getc(&tempbyte,f)) |
| 4645 | { | ||
| 4646 | ✗ | return qe_invalid; | |
| 4647 | } | ||
| 4648 | |||
| 4649 | 17216 | tempDMap.color = (word)tempbyte; | |
| 4650 | } | ||
| 4651 | |||
| 4652 |
2/4✓ Branch 0 taken 187200 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 187200 times.
✗ Branch 3 not taken.
|
187200 | if(!p_getc(&tempDMap.midi,f)) |
| 4653 | { | ||
| 4654 | ✗ | return qe_invalid; | |
| 4655 | } | ||
| 4656 | |||
| 4657 |
2/4✓ Branch 0 taken 187200 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 187200 times.
✗ Branch 3 not taken.
|
187200 | if(!p_getc(&tempDMap.cont,f)) |
| 4658 | { | ||
| 4659 | ✗ | return qe_invalid; | |
| 4660 | } | ||
| 4661 | |||
| 4662 |
2/4✓ Branch 0 taken 187200 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 187200 times.
✗ Branch 3 not taken.
|
187200 | if(!p_getc(&tempDMap.type,f)) |
| 4663 | { | ||
| 4664 | ✗ | return qe_invalid; | |
| 4665 | } | ||
| 4666 | |||
| 4667 |
4/4✓ Branch 0 taken 5298 times.
✓ Branch 1 taken 181902 times.
✓ Branch 2 taken 5254 times.
✓ Branch 3 taken 44 times.
|
192498 | if((tempDMap.type & dmfTYPE) == dmOVERW && |
| 4668 |
1/2✓ Branch 0 taken 5298 times.
✗ Branch 1 not taken.
|
5298 | (!Header || Header->zelda_version >= 0x210)) // Not sure exactly when this changed |
| 4669 | 5254 | tempDMap.xoff = 0; | |
| 4670 | |||
| 4671 |
2/2✓ Branch 0 taken 187200 times.
✓ Branch 1 taken 1497600 times.
|
1684800 | for(int32_t j=0; j<8; j++) |
| 4672 | { | ||
| 4673 |
2/4✓ Branch 0 taken 1497600 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1497600 times.
✗ Branch 3 not taken.
|
1497600 | if(!p_getc(&tempDMap.grid[j],f)) |
| 4674 | { | ||
| 4675 | ✗ | return qe_invalid; | |
| 4676 | } | ||
| 4677 | 1497600 | } | |
| 4678 | |||
| 4679 |
5/6✓ Branch 0 taken 187200 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 186624 times.
✓ Branch 3 taken 576 times.
✓ Branch 4 taken 1536 times.
✓ Branch 5 taken 185088 times.
|
187200 | if(Header && ((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<41)))) |
| 4680 | { | ||
| 4681 |
4/4✓ Branch 0 taken 137 times.
✓ Branch 1 taken 1975 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 127 times.
|
2112 | if(tempDMap.level>0&&tempDMap.level<10) |
| 4682 | { | ||
| 4683 | 127 | sprintf(legacy_title,"LEVEL-%d ", tempDMap.level); | |
| 4684 | 127 | } | |
| 4685 |
2/2✓ Branch 0 taken 576 times.
✓ Branch 1 taken 1536 times.
|
2112 | tempDMap.title.assign(legacy_title); |
| 4686 | |||
| 4687 |
3/4✓ Branch 0 taken 18 times.
✓ Branch 1 taken 558 times.
✓ Branch 2 taken 18 times.
✗ Branch 3 not taken.
|
576 | if(i==0 && Header->zelda_version <= 0x190) |
| 4688 | { | ||
| 4689 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | tempDMap.cont = std::max((int)tempDMap.cont - tempDMap.xoff, 0); |
| 4690 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | tempDMap.compass = std::max((int)tempDMap.compass - tempDMap.xoff, 0); |
| 4691 | 18 | } | |
| 4692 | |||
| 4693 | //forgotten -DD | ||
| 4694 |
2/2✓ Branch 0 taken 137 times.
✓ Branch 1 taken 439 times.
|
576 | if(tempDMap.level==0) |
| 4695 | { | ||
| 4696 | 439 | tempDMap.flags=dmfCAVES|dmf3STAIR|dmfWHIRLWIND|dmfGUYCAVES; | |
| 4697 | 439 | } | |
| 4698 | 576 | } | |
| 4699 | else | ||
| 4700 | { | ||
| 4701 |
3/4✓ Branch 0 taken 186624 times.
✓ Branch 1 taken 1536 times.
✓ Branch 2 taken 186624 times.
✗ Branch 3 not taken.
|
185088 | if(!p_getstr(tempDMap.name,sizeof(DMaps[0].name) - 1,f)) |
| 4702 | { | ||
| 4703 | ✗ | return qe_invalid; | |
| 4704 | } | ||
| 4705 | |||
| 4706 |
2/2✓ Branch 0 taken 122112 times.
✓ Branch 1 taken 64512 times.
|
186624 | if(s_version<20) |
| 4707 | { | ||
| 4708 |
2/4✓ Branch 0 taken 122112 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 122112 times.
✗ Branch 3 not taken.
|
122112 | if (!p_getstr(legacy_title, sizeof(legacy_title) - 1, f)) |
| 4709 | { | ||
| 4710 | ✗ | return qe_invalid; | |
| 4711 | } | ||
| 4712 |
1/2✓ Branch 0 taken 122112 times.
✗ Branch 1 not taken.
|
122112 | tempDMap.title.assign(legacy_title); |
| 4713 | 122112 | } | |
| 4714 | else | ||
| 4715 | { | ||
| 4716 |
2/4✓ Branch 0 taken 64512 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 64512 times.
✗ Branch 3 not taken.
|
64512 | if (!p_getwstr(&tempDMap.title, f)) |
| 4717 | { | ||
| 4718 | ✗ | return qe_invalid; | |
| 4719 | } | ||
| 4720 | } | ||
| 4721 | |||
| 4722 |
2/4✓ Branch 0 taken 186624 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 186624 times.
✗ Branch 3 not taken.
|
186624 | if(!p_getstr(tempDMap.intro,sizeof(DMaps[0].intro)-1,f)) |
| 4723 | { | ||
| 4724 | ✗ | return qe_invalid; | |
| 4725 | } | ||
| 4726 | |||
| 4727 |
5/8✓ Branch 0 taken 186624 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 186624 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1536 times.
✓ Branch 5 taken 185088 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1536 times.
|
186624 | if(Header && ((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<152)))) |
| 4728 | { | ||
| 4729 | ✗ | if ((tempDMap.type & dmfTYPE) == dmOVERW) tempDMap.flags = dmfCAVES | dmf3STAIR | dmfWHIRLWIND | dmfGUYCAVES; | |
| 4730 | ✗ | DMaps[i] = tempDMap; | |
| 4731 | |||
| 4732 | ✗ | continue; | |
| 4733 | } | ||
| 4734 | |||
| 4735 |
3/4✓ Branch 0 taken 186624 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✓ Branch 3 taken 185088 times.
|
186624 | if(Header && (Header->zelda_version < 0x193)) |
| 4736 | { | ||
| 4737 |
2/4✓ Branch 0 taken 1536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
|
1536 | if(!p_getc(&padding,f)) |
| 4738 | { | ||
| 4739 | ✗ | return qe_invalid; | |
| 4740 | } | ||
| 4741 | 1536 | } | |
| 4742 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 113408 times.
|
186624 | if ( s_version >= 11 ) |
| 4743 | { | ||
| 4744 |
2/4✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 73216 times.
✗ Branch 3 not taken.
|
73216 | if(!p_igetl(&tempDMap.minimap_1_tile,f)) |
| 4745 | { | ||
| 4746 | ✗ | return qe_invalid; | |
| 4747 | } | ||
| 4748 | 73216 | } | |
| 4749 | else | ||
| 4750 | { | ||
| 4751 |
2/4✓ Branch 0 taken 113408 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 113408 times.
✗ Branch 3 not taken.
|
113408 | if(!p_igetw(&tempDMap.minimap_1_tile,f)) |
| 4752 | { | ||
| 4753 | ✗ | return qe_invalid; | |
| 4754 | } | ||
| 4755 | } | ||
| 4756 | |||
| 4757 |
2/4✓ Branch 0 taken 186624 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 186624 times.
✗ Branch 3 not taken.
|
186624 | if(!p_getc(&tempDMap.minimap_1_cset,f)) |
| 4758 | { | ||
| 4759 | ✗ | return qe_invalid; | |
| 4760 | } | ||
| 4761 | |||
| 4762 |
3/4✓ Branch 0 taken 186624 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✓ Branch 3 taken 185088 times.
|
186624 | if(Header && (Header->zelda_version < 0x193)) |
| 4763 | { | ||
| 4764 |
2/4✓ Branch 0 taken 1536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
|
1536 | if(!p_getc(&padding,f)) |
| 4765 | { | ||
| 4766 | ✗ | return qe_invalid; | |
| 4767 | } | ||
| 4768 | 1536 | } | |
| 4769 | |||
| 4770 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 113408 times.
|
186624 | if ( s_version >= 11 ) |
| 4771 | { | ||
| 4772 |
2/4✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 73216 times.
✗ Branch 3 not taken.
|
73216 | if(!p_igetl(&tempDMap.minimap_2_tile,f)) |
| 4773 | { | ||
| 4774 | ✗ | return qe_invalid; | |
| 4775 | } | ||
| 4776 | 73216 | } | |
| 4777 | else | ||
| 4778 | { | ||
| 4779 |
2/4✓ Branch 0 taken 113408 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 113408 times.
✗ Branch 3 not taken.
|
113408 | if(!p_igetw(&tempDMap.minimap_2_tile,f)) |
| 4780 | { | ||
| 4781 | ✗ | return qe_invalid; | |
| 4782 | } | ||
| 4783 | } | ||
| 4784 |
2/4✓ Branch 0 taken 186624 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 186624 times.
✗ Branch 3 not taken.
|
186624 | if(!p_getc(&tempDMap.minimap_2_cset,f)) |
| 4785 | { | ||
| 4786 | ✗ | return qe_invalid; | |
| 4787 | } | ||
| 4788 | |||
| 4789 |
3/4✓ Branch 0 taken 186624 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✓ Branch 3 taken 185088 times.
|
186624 | if(Header && (Header->zelda_version < 0x193)) |
| 4790 | { | ||
| 4791 |
2/4✓ Branch 0 taken 1536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
|
1536 | if(!p_getc(&padding,f)) |
| 4792 | { | ||
| 4793 | ✗ | return qe_invalid; | |
| 4794 | } | ||
| 4795 | 1536 | } | |
| 4796 | |||
| 4797 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 113408 times.
|
186624 | if ( s_version >= 11 ) |
| 4798 | { | ||
| 4799 |
2/4✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 73216 times.
✗ Branch 3 not taken.
|
73216 | if(!p_igetl(&tempDMap.largemap_1_tile,f)) |
| 4800 | { | ||
| 4801 | ✗ | return qe_invalid; | |
| 4802 | } | ||
| 4803 | 73216 | } | |
| 4804 | else | ||
| 4805 | { | ||
| 4806 |
2/4✓ Branch 0 taken 113408 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 113408 times.
✗ Branch 3 not taken.
|
113408 | if(!p_igetw(&tempDMap.largemap_1_tile,f)) |
| 4807 | { | ||
| 4808 | ✗ | return qe_invalid; | |
| 4809 | } | ||
| 4810 | } | ||
| 4811 | |||
| 4812 |
2/4✓ Branch 0 taken 186624 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 186624 times.
✗ Branch 3 not taken.
|
186624 | if(!p_getc(&tempDMap.largemap_1_cset,f)) |
| 4813 | { | ||
| 4814 | ✗ | return qe_invalid; | |
| 4815 | } | ||
| 4816 | |||
| 4817 |
3/4✓ Branch 0 taken 186624 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✓ Branch 3 taken 185088 times.
|
186624 | if(Header && (Header->zelda_version < 0x193)) |
| 4818 | { | ||
| 4819 | |||
| 4820 |
2/4✓ Branch 0 taken 1536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
|
1536 | if(!p_getc(&padding,f)) |
| 4821 | { | ||
| 4822 | ✗ | return qe_invalid; | |
| 4823 | } | ||
| 4824 | 1536 | } | |
| 4825 | |||
| 4826 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 113408 times.
|
186624 | if ( s_version >= 11 ) |
| 4827 | { | ||
| 4828 |
2/4✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 73216 times.
✗ Branch 3 not taken.
|
73216 | if(!p_igetl(&tempDMap.largemap_2_tile,f)) |
| 4829 | { | ||
| 4830 | ✗ | return qe_invalid; | |
| 4831 | } | ||
| 4832 | 73216 | } | |
| 4833 | else | ||
| 4834 | { | ||
| 4835 |
2/4✓ Branch 0 taken 113408 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 113408 times.
✗ Branch 3 not taken.
|
113408 | if(!p_igetw(&tempDMap.largemap_2_tile,f)) |
| 4836 | { | ||
| 4837 | ✗ | return qe_invalid; | |
| 4838 | } | ||
| 4839 | } | ||
| 4840 |
2/4✓ Branch 0 taken 186624 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 186624 times.
✗ Branch 3 not taken.
|
186624 | if(!p_getc(&tempDMap.largemap_2_cset,f)) |
| 4841 | { | ||
| 4842 | ✗ | return qe_invalid; | |
| 4843 | } | ||
| 4844 | |||
| 4845 |
2/4✓ Branch 0 taken 186624 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 186624 times.
✗ Branch 3 not taken.
|
186624 | if(!p_getstr(tempDMap.tmusic,sizeof(DMaps[0].tmusic)-1,f)) |
| 4846 | { | ||
| 4847 | ✗ | return qe_invalid; | |
| 4848 | } | ||
| 4849 | } | ||
| 4850 | |||
| 4851 |
2/2✓ Branch 0 taken 169984 times.
✓ Branch 1 taken 17216 times.
|
187200 | if(s_version>1) |
| 4852 | { | ||
| 4853 |
2/4✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 169984 times.
✗ Branch 3 not taken.
|
169984 | if(!p_getc(&tempDMap.tmusictrack,f)) |
| 4854 | { | ||
| 4855 | ✗ | return qe_invalid; | |
| 4856 | } | ||
| 4857 | |||
| 4858 |
2/4✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 169984 times.
✗ Branch 3 not taken.
|
169984 | if(!p_getc(&tempDMap.active_subscreen,f)) |
| 4859 | { | ||
| 4860 | ✗ | return qe_invalid; | |
| 4861 | } | ||
| 4862 | |||
| 4863 |
2/4✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 169984 times.
✗ Branch 3 not taken.
|
169984 | if(!p_getc(&tempDMap.passive_subscreen,f)) |
| 4864 | { | ||
| 4865 | ✗ | return qe_invalid; | |
| 4866 | } | ||
| 4867 | 169984 | } | |
| 4868 | |||
| 4869 |
2/2✓ Branch 0 taken 169984 times.
✓ Branch 1 taken 17216 times.
|
187200 | if(s_version>2) |
| 4870 | { | ||
| 4871 | byte di[32]; | ||
| 4872 | |||
| 4873 |
2/4✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 169984 times.
✗ Branch 3 not taken.
|
169984 | if(!pfread(&di, 32, f)) return qe_invalid; |
| 4874 | |||
| 4875 |
2/2✓ Branch 0 taken 43515904 times.
✓ Branch 1 taken 169984 times.
|
43685888 | for(int32_t j=0; j<MAXITEMS; j++) |
| 4876 | { | ||
| 4877 |
2/2✓ Branch 0 taken 9038 times.
✓ Branch 1 taken 43506866 times.
|
43515904 | if(di[j/8] & (1 << (j%8))) tempDMap.disableditems[j]=1; |
| 4878 | 43506866 | else tempDMap.disableditems[j]=0; | |
| 4879 | 43515904 | } | |
| 4880 | 169984 | } | |
| 4881 | |||
| 4882 |
2/2✓ Branch 0 taken 169984 times.
✓ Branch 1 taken 17216 times.
|
187200 | if(s_version >= 6) |
| 4883 | { | ||
| 4884 |
2/4✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 169984 times.
✗ Branch 3 not taken.
|
169984 | if(!p_igetl(&tempDMap.flags,f)) |
| 4885 | { | ||
| 4886 | ✗ | return qe_invalid; | |
| 4887 | } | ||
| 4888 | 169984 | } | |
| 4889 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17216 times.
|
17216 | else if(s_version>3) |
| 4890 | { | ||
| 4891 | char temp; | ||
| 4892 | |||
| 4893 | ✗ | if(!p_getc(&temp,f)) | |
| 4894 | { | ||
| 4895 | ✗ | return qe_invalid; | |
| 4896 | } | ||
| 4897 | |||
| 4898 | ✗ | tempDMap.flags = temp; | |
| 4899 | ✗ | } | |
| 4900 |
3/8✓ Branch 0 taken 8992 times.
✓ Branch 1 taken 8224 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 8992 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
17216 | else if(tempDMap.level==0 && ((Header->zelda_version < 0x211) || ((Header->zelda_version == 0x211) && (Header->build<18)))) |
| 4901 | { | ||
| 4902 | 8992 | tempDMap.flags=dmfCAVES|dmf3STAIR|dmfWHIRLWIND|dmfGUYCAVES; | |
| 4903 | 8992 | } | |
| 4904 | else | ||
| 4905 | 8224 | tempDMap.flags=0; | |
| 4906 | |||
| 4907 |
2/2✓ Branch 0 taken 169984 times.
✓ Branch 1 taken 17216 times.
|
187200 | if(s_version<7) |
| 4908 | { | ||
| 4909 |
5/6✓ Branch 0 taken 8992 times.
✓ Branch 1 taken 8224 times.
✓ Branch 2 taken 8992 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2846 times.
✓ Branch 5 taken 6146 times.
|
17216 | if(tempDMap.level==0 && get_bit(deprecated_rules,14)) |
| 4910 | 6146 | tempDMap.flags|= dmfVIEWMAP; | |
| 4911 | 17216 | } | |
| 4912 | |||
| 4913 |
2/2✓ Branch 0 taken 169984 times.
✓ Branch 1 taken 17216 times.
|
187200 | if(s_version<8) |
| 4914 | { | ||
| 4915 |
4/4✓ Branch 0 taken 8992 times.
✓ Branch 1 taken 8224 times.
✓ Branch 2 taken 8050 times.
✓ Branch 3 taken 942 times.
|
17216 | if(tempDMap.level==0 && (tempDMap.type&dmfTYPE)==dmDNGN) |
| 4916 | { | ||
| 4917 |
1/2✓ Branch 0 taken 8050 times.
✗ Branch 1 not taken.
|
8050 | tempDMap.type &= ~dmDNGN; |
| 4918 | 8050 | tempDMap.type |= dmCAVE; | |
| 4919 | 8050 | } | |
| 4920 |
2/2✓ Branch 0 taken 6834 times.
✓ Branch 1 taken 2332 times.
|
9166 | else if((tempDMap.type&dmfTYPE)==dmCAVE) |
| 4921 | { | ||
| 4922 | 2332 | tempDMap.flags |= dmfMINIMAPCOLORFIX; | |
| 4923 | 2332 | } | |
| 4924 | 17216 | } | |
| 4925 | |||
| 4926 |
7/8✓ Branch 0 taken 187200 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2112 times.
✓ Branch 3 taken 185088 times.
✓ Branch 4 taken 1536 times.
✓ Branch 5 taken 576 times.
✓ Branch 6 taken 1536 times.
✓ Branch 7 taken 185088 times.
|
187200 | if(Header && ((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>=41))) |
| 4927 | 186624 | && (Header->zelda_version < 0x193)) | |
| 4928 | { | ||
| 4929 |
2/4✓ Branch 0 taken 1536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
|
1536 | if(!p_getc(&padding,f)) |
| 4930 | { | ||
| 4931 | ✗ | return qe_invalid; | |
| 4932 | } | ||
| 4933 | 1536 | } | |
| 4934 | |||
| 4935 |
2/2✓ Branch 0 taken 113984 times.
✓ Branch 1 taken 73216 times.
|
187200 | if(s_version >= 10) |
| 4936 | { | ||
| 4937 |
2/4✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 73216 times.
✗ Branch 3 not taken.
|
73216 | if(!p_getc(&tempDMap.sideview,f)) |
| 4938 | { | ||
| 4939 | ✗ | return qe_invalid; | |
| 4940 | } | ||
| 4941 | 73216 | } | |
| 4942 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 113984 times.
|
187200 | if(s_version < 10) tempDMap.sideview = 0; |
| 4943 | |||
| 4944 | //Dmap Scripts | ||
| 4945 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 113984 times.
|
187200 | if(s_version >= 12) |
| 4946 | { | ||
| 4947 |
2/4✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 73216 times.
✗ Branch 3 not taken.
|
73216 | if(!p_igetw(&tempDMap.script,f)) |
| 4948 | { | ||
| 4949 | ✗ | return qe_invalid; | |
| 4950 | } | ||
| 4951 |
2/2✓ Branch 0 taken 585728 times.
✓ Branch 1 taken 73216 times.
|
658944 | for ( int32_t q = 0; q < 8; q++ ) |
| 4952 | { | ||
| 4953 |
2/4✓ Branch 0 taken 585728 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 585728 times.
✗ Branch 3 not taken.
|
585728 | if(!p_igetl(&tempDMap.initD[q],f)) |
| 4954 | { | ||
| 4955 | ✗ | return qe_invalid; | |
| 4956 | } | ||
| 4957 | 585728 | } | |
| 4958 | 73216 | } | |
| 4959 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 113984 times.
|
187200 | if ( s_version < 12 ) |
| 4960 | { | ||
| 4961 | 113984 | tempDMap.script = 0; | |
| 4962 |
2/2✓ Branch 0 taken 911872 times.
✓ Branch 1 taken 113984 times.
|
1025856 | for ( int32_t q = 0; q < 8; q++ ) |
| 4963 | { | ||
| 4964 | 911872 | tempDMap.initD[q] = 0; | |
| 4965 | 911872 | } | |
| 4966 | 113984 | } | |
| 4967 | |||
| 4968 |
2/2✓ Branch 0 taken 113984 times.
✓ Branch 1 taken 73216 times.
|
187200 | if(s_version >= 13) |
| 4969 | { | ||
| 4970 |
2/2✓ Branch 0 taken 585728 times.
✓ Branch 1 taken 73216 times.
|
658944 | for ( int32_t q = 0; q < 8; q++ ) |
| 4971 | { | ||
| 4972 |
2/2✓ Branch 0 taken 38072320 times.
✓ Branch 1 taken 585728 times.
|
38658048 | for ( int32_t w = 0; w < 65; w++ ) |
| 4973 | { | ||
| 4974 |
2/4✓ Branch 0 taken 38072320 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 38072320 times.
✗ Branch 3 not taken.
|
38072320 | if(!p_getc(&tempDMap.initD_label[q][w],f)) |
| 4975 | { | ||
| 4976 | ✗ | return qe_invalid; | |
| 4977 | } | ||
| 4978 | 38072320 | } | |
| 4979 | 585728 | } | |
| 4980 | 73216 | } | |
| 4981 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 113984 times.
|
187200 | if ( s_version < 13 ) |
| 4982 | { | ||
| 4983 | 113984 | tempDMap.script = 0; | |
| 4984 |
2/2✓ Branch 0 taken 911872 times.
✓ Branch 1 taken 113984 times.
|
1025856 | for ( int32_t q = 0; q < 8; q++ ) |
| 4985 | { | ||
| 4986 |
2/2✓ Branch 0 taken 59271680 times.
✓ Branch 1 taken 911872 times.
|
60183552 | for ( int32_t w = 0; w < 65; w++ ) |
| 4987 | 59271680 | tempDMap.initD_label[q][w] = 0; | |
| 4988 | 911872 | } | |
| 4989 | 113984 | } | |
| 4990 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 113984 times.
|
187200 | if(s_version >= 14) |
| 4991 | { | ||
| 4992 |
2/4✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 73216 times.
✗ Branch 3 not taken.
|
73216 | if(!p_igetw(&tempDMap.active_sub_script,f)) |
| 4993 | { | ||
| 4994 | ✗ | return qe_invalid; | |
| 4995 | } | ||
| 4996 |
2/4✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 73216 times.
✗ Branch 3 not taken.
|
73216 | if(!p_igetw(&tempDMap.passive_sub_script,f)) |
| 4997 | { | ||
| 4998 | ✗ | return qe_invalid; | |
| 4999 | } | ||
| 5000 |
2/2✓ Branch 0 taken 585728 times.
✓ Branch 1 taken 73216 times.
|
658944 | for ( int32_t q = 0; q < 8; ++q ) |
| 5001 | { | ||
| 5002 |
2/4✓ Branch 0 taken 585728 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 585728 times.
✗ Branch 3 not taken.
|
585728 | if(!p_igetl(&tempDMap.sub_initD[q],f)) |
| 5003 | { | ||
| 5004 | ✗ | return qe_invalid; | |
| 5005 | } | ||
| 5006 | 585728 | } | |
| 5007 |
2/2✓ Branch 0 taken 585728 times.
✓ Branch 1 taken 73216 times.
|
658944 | for(int32_t q = 0; q < 8; ++q) |
| 5008 | { | ||
| 5009 |
2/2✓ Branch 0 taken 38072320 times.
✓ Branch 1 taken 585728 times.
|
38658048 | for ( int32_t w = 0; w < 65; ++w ) |
| 5010 | { | ||
| 5011 |
2/4✓ Branch 0 taken 38072320 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 38072320 times.
✗ Branch 3 not taken.
|
38072320 | if(!p_getc(&tempDMap.sub_initD_label[q][w],f)) |
| 5012 | { | ||
| 5013 | ✗ | return qe_invalid; | |
| 5014 | } | ||
| 5015 | 38072320 | } | |
| 5016 | 585728 | } | |
| 5017 | 73216 | } | |
| 5018 | else | ||
| 5019 | { | ||
| 5020 | 113984 | tempDMap.active_sub_script = 0; | |
| 5021 | 113984 | tempDMap.passive_sub_script = 0; | |
| 5022 |
2/2✓ Branch 0 taken 911872 times.
✓ Branch 1 taken 113984 times.
|
1025856 | for(int32_t q = 0; q < 8; ++q) |
| 5023 | { | ||
| 5024 | 911872 | tempDMap.sub_initD[q] = 0; | |
| 5025 |
2/2✓ Branch 0 taken 59271680 times.
✓ Branch 1 taken 911872 times.
|
60183552 | for(int32_t w = 0; w < 65; ++w) |
| 5026 | 59271680 | tempDMap.sub_initD_label[q][w] = 0; | |
| 5027 | 911872 | } | |
| 5028 | } | ||
| 5029 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 113984 times.
|
187200 | if(s_version >= 15) |
| 5030 | { | ||
| 5031 |
2/4✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 73216 times.
✗ Branch 3 not taken.
|
73216 | if(!p_igetw(&tempDMap.onmap_script,f)) |
| 5032 | { | ||
| 5033 | ✗ | return qe_invalid; | |
| 5034 | } | ||
| 5035 |
2/2✓ Branch 0 taken 585728 times.
✓ Branch 1 taken 73216 times.
|
658944 | for ( int32_t q = 0; q < 8; ++q ) |
| 5036 | { | ||
| 5037 |
2/4✓ Branch 0 taken 585728 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 585728 times.
✗ Branch 3 not taken.
|
585728 | if(!p_igetl(&tempDMap.onmap_initD[q],f)) |
| 5038 | { | ||
| 5039 | ✗ | return qe_invalid; | |
| 5040 | } | ||
| 5041 | 585728 | } | |
| 5042 |
2/2✓ Branch 0 taken 585728 times.
✓ Branch 1 taken 73216 times.
|
658944 | for(int32_t q = 0; q < 8; ++q) |
| 5043 | { | ||
| 5044 |
2/2✓ Branch 0 taken 38072320 times.
✓ Branch 1 taken 585728 times.
|
38658048 | for ( int32_t w = 0; w < 65; ++w ) |
| 5045 | { | ||
| 5046 |
2/4✓ Branch 0 taken 38072320 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 38072320 times.
✗ Branch 3 not taken.
|
38072320 | if(!p_getc(&tempDMap.onmap_initD_label[q][w],f)) |
| 5047 | { | ||
| 5048 | ✗ | return qe_invalid; | |
| 5049 | } | ||
| 5050 | 38072320 | } | |
| 5051 | 585728 | } | |
| 5052 | 73216 | } | |
| 5053 | else | ||
| 5054 | { | ||
| 5055 | 113984 | tempDMap.onmap_script = 0; | |
| 5056 |
2/2✓ Branch 0 taken 911872 times.
✓ Branch 1 taken 113984 times.
|
1025856 | for(int32_t q = 0; q < 8; ++q) |
| 5057 | { | ||
| 5058 | 911872 | tempDMap.onmap_initD[q] = 0; | |
| 5059 |
2/2✓ Branch 0 taken 59271680 times.
✓ Branch 1 taken 911872 times.
|
60183552 | for(int32_t w = 0; w < 65; ++w) |
| 5060 | { | ||
| 5061 | 59271680 | tempDMap.onmap_initD_label[q][w] = 0; | |
| 5062 | 59271680 | } | |
| 5063 | 911872 | } | |
| 5064 | } | ||
| 5065 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 113984 times.
|
187200 | if(s_version >= 16) |
| 5066 | { | ||
| 5067 |
2/4✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 73216 times.
✗ Branch 3 not taken.
|
73216 | if(!p_igetw(&tempDMap.mirrorDMap,f)) |
| 5068 | { | ||
| 5069 | ✗ | return qe_invalid; | |
| 5070 | } | ||
| 5071 | 73216 | } | |
| 5072 | else | ||
| 5073 | { | ||
| 5074 | 113984 | tempDMap.mirrorDMap = -1; | |
| 5075 | } | ||
| 5076 | |||
| 5077 |
2/2✓ Branch 0 taken 122688 times.
✓ Branch 1 taken 64512 times.
|
187200 | if (s_version >= 17) |
| 5078 | { | ||
| 5079 | // Reserved for z3. | ||
| 5080 | 64512 | } | |
| 5081 | |||
| 5082 | // Enhanced music loop points | ||
| 5083 |
2/2✓ Branch 0 taken 64512 times.
✓ Branch 1 taken 122688 times.
|
187200 | if (s_version >= 18) |
| 5084 | { | ||
| 5085 |
2/4✓ Branch 0 taken 64512 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 64512 times.
✗ Branch 3 not taken.
|
64512 | if (!p_igetl(&tempDMap.tmusic_loop_start, f)) |
| 5086 | { | ||
| 5087 | ✗ | return qe_invalid; | |
| 5088 | } | ||
| 5089 |
2/4✓ Branch 0 taken 64512 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 64512 times.
✗ Branch 3 not taken.
|
64512 | if (!p_igetl(&tempDMap.tmusic_loop_end, f)) |
| 5090 | { | ||
| 5091 | ✗ | return qe_invalid; | |
| 5092 | } | ||
| 5093 |
2/4✓ Branch 0 taken 64512 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 64512 times.
✗ Branch 3 not taken.
|
64512 | if (!p_igetl(&tempDMap.tmusic_xfade_in, f)) |
| 5094 | { | ||
| 5095 | ✗ | return qe_invalid; | |
| 5096 | } | ||
| 5097 |
2/4✓ Branch 0 taken 64512 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 64512 times.
✗ Branch 3 not taken.
|
64512 | if (!p_igetl(&tempDMap.tmusic_xfade_out, f)) |
| 5098 | { | ||
| 5099 | ✗ | return qe_invalid; | |
| 5100 | } | ||
| 5101 | 64512 | } | |
| 5102 | else | ||
| 5103 | { | ||
| 5104 | 122688 | tempDMap.tmusic_loop_start = 0; | |
| 5105 | 122688 | tempDMap.tmusic_loop_end = 0; | |
| 5106 | 122688 | tempDMap.tmusic_xfade_in = 0; | |
| 5107 | 122688 | tempDMap.tmusic_xfade_out = 0; | |
| 5108 | } | ||
| 5109 | |||
| 5110 |
2/2✓ Branch 0 taken 64512 times.
✓ Branch 1 taken 122688 times.
|
187200 | if(s_version >= 19) |
| 5111 |
2/4✓ Branch 0 taken 64512 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 64512 times.
✗ Branch 3 not taken.
|
64512 | if(!p_getc(&tempDMap.overlay_subscreen, f)) |
| 5112 | ✗ | return qe_invalid; | |
| 5113 | |||
| 5114 |
2/2✓ Branch 0 taken 64512 times.
✓ Branch 1 taken 122688 times.
|
187200 | if (s_version >= 20) |
| 5115 | { | ||
| 5116 |
2/4✓ Branch 0 taken 64512 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 64512 times.
✗ Branch 3 not taken.
|
64512 | if (!p_igetl(&tempDMap.intro_string_id, f)) |
| 5117 | ✗ | return qe_invalid; | |
| 5118 | 64512 | } | |
| 5119 | else | ||
| 5120 | 122688 | tempDMap.intro_string_id = 0; | |
| 5121 | |||
| 5122 | // Reserved for z3. | ||
| 5123 |
2/2✓ Branch 0 taken 122688 times.
✓ Branch 1 taken 64512 times.
|
187200 | if(s_version >= 21) |
| 5124 | { | ||
| 5125 |
2/2✓ Branch 0 taken 516096 times.
✓ Branch 1 taken 64512 times.
|
580608 | for(int32_t j=0; j<8; j++) |
| 5126 | { | ||
| 5127 |
2/2✓ Branch 0 taken 4128768 times.
✓ Branch 1 taken 516096 times.
|
4644864 | for(int32_t k=0; k<8; k++) |
| 5128 | { | ||
| 5129 | char c; | ||
| 5130 |
2/4✓ Branch 0 taken 4128768 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4128768 times.
✗ Branch 3 not taken.
|
4128768 | if(!p_getc(&c,f)) |
| 5131 | { | ||
| 5132 | ✗ | return qe_invalid; | |
| 5133 | } | ||
| 5134 | 4128768 | } | |
| 5135 | 516096 | } | |
| 5136 | 64512 | } | |
| 5137 | |||
| 5138 |
2/2✓ Branch 0 taken 186944 times.
✓ Branch 1 taken 256 times.
|
187200 | if (!should_skip) |
| 5139 | { | ||
| 5140 |
1/2✓ Branch 0 taken 186944 times.
✗ Branch 1 not taken.
|
186944 | if(loading_tileset_flags & TILESET_CLEARMAPS) |
| 5141 | ✗ | tempDMap.map = 0; | |
| 5142 |
1/2✓ Branch 0 taken 186944 times.
✗ Branch 1 not taken.
|
186944 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 5143 | { | ||
| 5144 | ✗ | tempDMap.script = 0; | |
| 5145 | ✗ | for(int q = 0; q < 8; ++q) | |
| 5146 | ✗ | tempDMap.initD[q] = 0; | |
| 5147 | ✗ | } | |
| 5148 |
1/2✓ Branch 0 taken 186944 times.
✗ Branch 1 not taken.
|
186944 | DMaps[i] = tempDMap; |
| 5149 | 186944 | } | |
| 5150 | 187200 | } | |
| 5151 | |||
| 5152 | 415 | return 0; | |
| 5153 | 6559 | } | |
| 5154 | |||
| 5155 | 332 | int32_t readmisccolors(PACKFILE *f, zquestheader *Header, miscQdata *Misc) | |
| 5156 | { | ||
| 5157 | //these are here to bypass compiler warnings about unused arguments | ||
| 5158 | 332 | Header=Header; | |
| 5159 | |||
| 5160 | miscQdata temp_misc; | ||
| 5161 | 332 | word s_version=0, s_cversion=0; | |
| 5162 | 332 | int32_t tempsize=0; | |
| 5163 | word dummyw; | ||
| 5164 | |||
| 5165 | 332 | memcpy(&temp_misc,Misc,sizeof(temp_misc)); | |
| 5166 | |||
| 5167 | //section version info | ||
| 5168 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | if(!p_igetw(&s_version,f)) |
| 5169 | { | ||
| 5170 | ✗ | return qe_invalid; | |
| 5171 | } | ||
| 5172 | |||
| 5173 | 332 | FFCore.quest_format[vColours] = s_version; | |
| 5174 | |||
| 5175 | 332 | al_trace("Misc Colours section version: %d\n", s_version); | |
| 5176 | |||
| 5177 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_igetw(&s_cversion,f)) |
| 5178 | { | ||
| 5179 | ✗ | return qe_invalid; | |
| 5180 | } | ||
| 5181 | |||
| 5182 | |||
| 5183 | //section size | ||
| 5184 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_igetl(&tempsize,f)) |
| 5185 | { | ||
| 5186 | ✗ | return qe_invalid; | |
| 5187 | } | ||
| 5188 | |||
| 5189 | //finally... section data | ||
| 5190 | 332 | readsize=0; | |
| 5191 | |||
| 5192 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_getc(&temp_misc.colors.text,f)) |
| 5193 | { | ||
| 5194 | ✗ | return qe_invalid; | |
| 5195 | } | ||
| 5196 | |||
| 5197 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_getc(&temp_misc.colors.caption,f)) |
| 5198 | { | ||
| 5199 | ✗ | return qe_invalid; | |
| 5200 | } | ||
| 5201 | |||
| 5202 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_getc(&temp_misc.colors.overw_bg,f)) |
| 5203 | { | ||
| 5204 | ✗ | return qe_invalid; | |
| 5205 | } | ||
| 5206 | |||
| 5207 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_getc(&temp_misc.colors.dngn_bg,f)) |
| 5208 | { | ||
| 5209 | ✗ | return qe_invalid; | |
| 5210 | } | ||
| 5211 | |||
| 5212 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_getc(&temp_misc.colors.dngn_fg,f)) |
| 5213 | { | ||
| 5214 | ✗ | return qe_invalid; | |
| 5215 | } | ||
| 5216 | |||
| 5217 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_getc(&temp_misc.colors.cave_fg,f)) |
| 5218 | { | ||
| 5219 | ✗ | return qe_invalid; | |
| 5220 | } | ||
| 5221 | |||
| 5222 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_getc(&temp_misc.colors.bs_dk,f)) |
| 5223 | { | ||
| 5224 | ✗ | return qe_invalid; | |
| 5225 | } | ||
| 5226 | |||
| 5227 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_getc(&temp_misc.colors.bs_goal,f)) |
| 5228 | { | ||
| 5229 | ✗ | return qe_invalid; | |
| 5230 | } | ||
| 5231 | |||
| 5232 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_getc(&temp_misc.colors.compass_lt,f)) |
| 5233 | { | ||
| 5234 | ✗ | return qe_invalid; | |
| 5235 | } | ||
| 5236 | |||
| 5237 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_getc(&temp_misc.colors.compass_dk,f)) |
| 5238 | { | ||
| 5239 | ✗ | return qe_invalid; | |
| 5240 | } | ||
| 5241 | |||
| 5242 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_getc(&temp_misc.colors.subscr_bg,f)) |
| 5243 | { | ||
| 5244 | ✗ | return qe_invalid; | |
| 5245 | } | ||
| 5246 | |||
| 5247 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_getc(&temp_misc.colors.triframe_color,f)) |
| 5248 | { | ||
| 5249 | ✗ | return qe_invalid; | |
| 5250 | } | ||
| 5251 | |||
| 5252 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_getc(&temp_misc.colors.hero_dot,f)) |
| 5253 | { | ||
| 5254 | ✗ | return qe_invalid; | |
| 5255 | } | ||
| 5256 | |||
| 5257 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_getc(&temp_misc.colors.bmap_bg,f)) |
| 5258 | { | ||
| 5259 | ✗ | return qe_invalid; | |
| 5260 | } | ||
| 5261 | |||
| 5262 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_getc(&temp_misc.colors.bmap_fg,f)) |
| 5263 | { | ||
| 5264 | ✗ | return qe_invalid; | |
| 5265 | } | ||
| 5266 | |||
| 5267 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_getc(&temp_misc.colors.triforce_cset,f)) |
| 5268 | { | ||
| 5269 | ✗ | return qe_invalid; | |
| 5270 | } | ||
| 5271 | |||
| 5272 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_getc(&temp_misc.colors.triframe_cset,f)) |
| 5273 | { | ||
| 5274 | ✗ | return qe_invalid; | |
| 5275 | } | ||
| 5276 | |||
| 5277 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_getc(&temp_misc.colors.overworld_map_cset,f)) |
| 5278 | { | ||
| 5279 | ✗ | return qe_invalid; | |
| 5280 | } | ||
| 5281 | |||
| 5282 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_getc(&temp_misc.colors.dungeon_map_cset,f)) |
| 5283 | { | ||
| 5284 | ✗ | return qe_invalid; | |
| 5285 | } | ||
| 5286 | |||
| 5287 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_getc(&temp_misc.colors.blueframe_cset,f)) |
| 5288 | { | ||
| 5289 | ✗ | return qe_invalid; | |
| 5290 | } | ||
| 5291 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 189 times.
|
332 | if(s_version < 4) |
| 5292 | { | ||
| 5293 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(!p_igetw(&dummyw,f)) |
| 5294 | ✗ | return qe_invalid; | |
| 5295 | 189 | temp_misc.colors.triforce_tile = dummyw; | |
| 5296 | |||
| 5297 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(!p_igetw(&dummyw,f)) |
| 5298 | ✗ | return qe_invalid; | |
| 5299 | 189 | temp_misc.colors.triframe_tile = dummyw; | |
| 5300 | |||
| 5301 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(!p_igetw(&dummyw,f)) |
| 5302 | ✗ | return qe_invalid; | |
| 5303 | 189 | temp_misc.colors.overworld_map_tile = dummyw; | |
| 5304 | |||
| 5305 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(!p_igetw(&dummyw,f)) |
| 5306 | ✗ | return qe_invalid; | |
| 5307 | 189 | temp_misc.colors.dungeon_map_tile = dummyw; | |
| 5308 | |||
| 5309 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(!p_igetw(&dummyw,f)) |
| 5310 | ✗ | return qe_invalid; | |
| 5311 | 189 | temp_misc.colors.blueframe_tile = dummyw; | |
| 5312 | |||
| 5313 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(!p_igetw(&dummyw,f)) |
| 5314 | ✗ | return qe_invalid; | |
| 5315 | 189 | temp_misc.colors.HCpieces_tile = dummyw; | |
| 5316 | 189 | } | |
| 5317 | |||
| 5318 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_getc(&temp_misc.colors.HCpieces_cset,f)) |
| 5319 | { | ||
| 5320 | ✗ | return qe_invalid; | |
| 5321 | } | ||
| 5322 | |||
| 5323 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_getc(&temp_misc.colors.subscr_shadow,f)) |
| 5324 | { | ||
| 5325 | ✗ | return qe_invalid; | |
| 5326 | } | ||
| 5327 | |||
| 5328 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | if(s_version < 2) |
| 5329 | { | ||
| 5330 | ✗ | temp_misc.colors.msgtext = 0x01; | |
| 5331 | ✗ | } | |
| 5332 | else | ||
| 5333 | { | ||
| 5334 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_getc(&temp_misc.colors.msgtext, f)) |
| 5335 | { | ||
| 5336 | ✗ | return qe_invalid; | |
| 5337 | } | ||
| 5338 | } | ||
| 5339 | |||
| 5340 |
2/2✓ Branch 0 taken 189 times.
✓ Branch 1 taken 143 times.
|
332 | if ( s_version >= 3 ) //expanded tile pages to 825 |
| 5341 | { | ||
| 5342 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_igetl(&temp_misc.colors.triforce_tile,f)) |
| 5343 | { | ||
| 5344 | ✗ | return qe_invalid; | |
| 5345 | } | ||
| 5346 | |||
| 5347 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_igetl(&temp_misc.colors.triframe_tile,f)) |
| 5348 | { | ||
| 5349 | ✗ | return qe_invalid; | |
| 5350 | } | ||
| 5351 | |||
| 5352 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_igetl(&temp_misc.colors.overworld_map_tile,f)) |
| 5353 | { | ||
| 5354 | ✗ | return qe_invalid; | |
| 5355 | } | ||
| 5356 | |||
| 5357 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_igetl(&temp_misc.colors.dungeon_map_tile,f)) |
| 5358 | { | ||
| 5359 | ✗ | return qe_invalid; | |
| 5360 | } | ||
| 5361 | |||
| 5362 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_igetl(&temp_misc.colors.blueframe_tile,f)) |
| 5363 | { | ||
| 5364 | ✗ | return qe_invalid; | |
| 5365 | } | ||
| 5366 | |||
| 5367 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 143 times.
|
143 | if(!p_igetl(&temp_misc.colors.HCpieces_tile,f)) |
| 5368 | { | ||
| 5369 | ✗ | return qe_invalid; | |
| 5370 | } | ||
| 5371 | 143 | } | |
| 5372 | |||
| 5373 | 332 | memcpy(Misc, &temp_misc, sizeof(temp_misc)); | |
| 5374 | |||
| 5375 | 332 | return 0; | |
| 5376 | 332 | } | |
| 5377 | |||
| 5378 | 332 | int32_t readgameicons(PACKFILE *f, zquestheader *, miscQdata *Misc) | |
| 5379 | { | ||
| 5380 | miscQdata temp_misc; | ||
| 5381 | 332 | word s_version=0, s_cversion=0; | |
| 5382 | byte icons; | ||
| 5383 | 332 | int32_t tempsize=0; | |
| 5384 | |||
| 5385 | 332 | memcpy(&temp_misc,Misc,sizeof(temp_misc)); | |
| 5386 | |||
| 5387 | //section version info | ||
| 5388 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | if(!p_igetw(&s_version,f)) |
| 5389 | { | ||
| 5390 | ✗ | return qe_invalid; | |
| 5391 | } | ||
| 5392 | |||
| 5393 | 332 | FFCore.quest_format[vIcons] = s_version; | |
| 5394 | |||
| 5395 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_igetw(&s_cversion,f)) |
| 5396 | { | ||
| 5397 | ✗ | return qe_invalid; | |
| 5398 | } | ||
| 5399 | |||
| 5400 | |||
| 5401 | //section size | ||
| 5402 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_igetl(&tempsize,f)) |
| 5403 | { | ||
| 5404 | ✗ | return qe_invalid; | |
| 5405 | } | ||
| 5406 | |||
| 5407 | //finally... section data | ||
| 5408 | 332 | readsize=0; | |
| 5409 | |||
| 5410 | 332 | icons=4; | |
| 5411 | |||
| 5412 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 189 times.
|
332 | if ( s_version >= 10 ) |
| 5413 | { | ||
| 5414 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t i=0; i<icons; i++) |
| 5415 | { | ||
| 5416 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_igetl(&temp_misc.icons[i],f)) |
| 5417 | { | ||
| 5418 | ✗ | return qe_invalid; | |
| 5419 | } | ||
| 5420 | 572 | } | |
| 5421 | 143 | } | |
| 5422 | else | ||
| 5423 | { | ||
| 5424 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 189 times.
|
945 | for(int32_t i=0; i<icons; i++) |
| 5425 | { | ||
| 5426 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 756 times.
|
756 | if(!p_igetw(&temp_misc.icons[i],f)) |
| 5427 | { | ||
| 5428 | ✗ | return qe_invalid; | |
| 5429 | } | ||
| 5430 | 756 | } | |
| 5431 | } | ||
| 5432 | |||
| 5433 | 332 | memcpy(Misc, &temp_misc, sizeof(temp_misc)); | |
| 5434 | |||
| 5435 | 332 | return 0; | |
| 5436 | 332 | } | |
| 5437 | |||
| 5438 | 690 | int32_t readmisc(PACKFILE *f, zquestheader *Header, miscQdata *Misc) | |
| 5439 | { | ||
| 5440 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 666 times.
|
690 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_misc); |
| 5441 | |||
| 5442 | 690 | word maxinfos=256; | |
| 5443 | 690 | word maxshops=256; | |
| 5444 | 690 | word shops=16, infos=16, warprings=8, palcycles=256, windwarps=9, triforces=8, icons=4; | |
| 5445 | 690 | word ponds=16, pondsize=72, expansionsize=98*2; | |
| 5446 | byte tempbyte, padding; | ||
| 5447 | miscQdata temp_misc; | ||
| 5448 | 690 | word s_version=0, s_cversion=0; | |
| 5449 | word swaptmp; | ||
| 5450 | 690 | int32_t tempsize=0; | |
| 5451 | |||
| 5452 | 690 | memcpy(&temp_misc,Misc,sizeof(temp_misc)); | |
| 5453 | |||
| 5454 |
2/2✓ Branch 0 taken 176640 times.
✓ Branch 1 taken 690 times.
|
177330 | for(int32_t i=0; i<maxshops; ++i) |
| 5455 | { | ||
| 5456 | 176640 | memset(&temp_misc.shop, 0, sizeof(shoptype)*256); | |
| 5457 | 176640 | } | |
| 5458 | |||
| 5459 |
2/2✓ Branch 0 taken 176640 times.
✓ Branch 1 taken 690 times.
|
177330 | for(int32_t i=0; i<maxinfos; ++i) |
| 5460 | { | ||
| 5461 | 176640 | memset(&temp_misc.info, 0, sizeof(infotype)*256); | |
| 5462 | 176640 | } | |
| 5463 | |||
| 5464 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 666 times.
|
690 | if(Header->zelda_version > 0x192) |
| 5465 | { | ||
| 5466 | //section version info | ||
| 5467 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!p_igetw(&s_version,f)) |
| 5468 | { | ||
| 5469 | ✗ | return qe_invalid; | |
| 5470 | } | ||
| 5471 | |||
| 5472 | 666 | FFCore.quest_format[vMisc] = s_version; | |
| 5473 | |||
| 5474 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!p_igetw(&s_cversion,f)) |
| 5475 | { | ||
| 5476 | ✗ | return qe_invalid; | |
| 5477 | } | ||
| 5478 | |||
| 5479 | |||
| 5480 | //section size | ||
| 5481 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!p_igetl(&tempsize,f)) |
| 5482 | { | ||
| 5483 | ✗ | return qe_invalid; | |
| 5484 | } | ||
| 5485 | 666 | } | |
| 5486 | |||
| 5487 | //finally... section data | ||
| 5488 | 690 | readsize=0; | |
| 5489 | |||
| 5490 | //shops | ||
| 5491 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 666 times.
|
690 | if(Header->zelda_version > 0x192) |
| 5492 | { | ||
| 5493 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!p_igetw(&shops,f)) |
| 5494 | { | ||
| 5495 | ✗ | return qe_invalid; | |
| 5496 | } | ||
| 5497 | 666 | } | |
| 5498 | |||
| 5499 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 690 times.
|
690 | if (shops > NUM_SHOPS) |
| 5500 | { | ||
| 5501 | ✗ | return qe_invalid; | |
| 5502 | } | ||
| 5503 | |||
| 5504 |
2/2✓ Branch 0 taken 9891 times.
✓ Branch 1 taken 690 times.
|
10581 | for(int32_t i=0; i<shops; i++) |
| 5505 | { | ||
| 5506 |
2/2✓ Branch 0 taken 1200 times.
✓ Branch 1 taken 8691 times.
|
9891 | if(s_version > 6) |
| 5507 | { | ||
| 5508 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8691 times.
|
8691 | if(!p_getstr(temp_misc.shop[i].name,sizeof(temp_misc.shop[i].name)-1,f)) |
| 5509 | { | ||
| 5510 | ✗ | return qe_invalid; | |
| 5511 | } | ||
| 5512 | 8691 | } | |
| 5513 | |||
| 5514 |
2/2✓ Branch 0 taken 29673 times.
✓ Branch 1 taken 9891 times.
|
39564 | for(int32_t j=0; j<3; j++) |
| 5515 | { | ||
| 5516 |
1/2✓ Branch 0 taken 29673 times.
✗ Branch 1 not taken.
|
29673 | if(!p_getc(&temp_misc.shop[i].item[j],f)) |
| 5517 | { | ||
| 5518 | ✗ | return qe_invalid; | |
| 5519 | } | ||
| 5520 | |||
| 5521 |
2/2✓ Branch 0 taken 26073 times.
✓ Branch 1 taken 3600 times.
|
29673 | if(s_version < 4) |
| 5522 | { | ||
| 5523 | 3600 | temp_misc.shop[i].hasitem[j] = (temp_misc.shop[i].item[j] == 0) ? 0 : 1; | |
| 5524 | 3600 | } | |
| 5525 | 29673 | } | |
| 5526 | |||
| 5527 |
2/2✓ Branch 0 taken 9507 times.
✓ Branch 1 taken 384 times.
|
9891 | if(Header->zelda_version < 0x193) |
| 5528 | { | ||
| 5529 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 384 times.
|
384 | if(!p_getc(&tempbyte,f)) |
| 5530 | { | ||
| 5531 | ✗ | return qe_invalid; | |
| 5532 | } | ||
| 5533 | 384 | } | |
| 5534 | |||
| 5535 |
2/2✓ Branch 0 taken 29673 times.
✓ Branch 1 taken 9891 times.
|
39564 | for(int32_t j=0; j<3; j++) |
| 5536 | { | ||
| 5537 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29673 times.
|
29673 | if(!p_igetw(&temp_misc.shop[i].price[j],f)) |
| 5538 | { | ||
| 5539 | ✗ | return qe_invalid; | |
| 5540 | } | ||
| 5541 | 29673 | } | |
| 5542 | |||
| 5543 |
2/2✓ Branch 0 taken 1200 times.
✓ Branch 1 taken 8691 times.
|
9891 | if(s_version > 3) |
| 5544 | { | ||
| 5545 |
2/2✓ Branch 0 taken 26073 times.
✓ Branch 1 taken 8691 times.
|
34764 | for(int32_t j=0; j<3; j++) |
| 5546 | { | ||
| 5547 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26073 times.
|
26073 | if(!p_getc(&temp_misc.shop[i].hasitem[j],f)) |
| 5548 | ✗ | return qe_invalid; | |
| 5549 | 26073 | } | |
| 5550 | 8691 | } | |
| 5551 | |||
| 5552 | /* | ||
| 5553 | if(s_version < 8) | ||
| 5554 | { | ||
| 5555 | for(int32_t j=0; j<3; j++) | ||
| 5556 | { | ||
| 5557 | (&temp_misc.shop[i].str[j])=0; //initialise. | ||
| 5558 | } | ||
| 5559 | } | ||
| 5560 | */ | ||
| 5561 | 9891 | } | |
| 5562 | |||
| 5563 | //filter all the 0 items to the end (yeah, bubble sort; sue me) | ||
| 5564 |
2/2✓ Branch 0 taken 176640 times.
✓ Branch 1 taken 690 times.
|
177330 | for(int32_t i=0; i<maxshops; ++i) |
| 5565 | { | ||
| 5566 |
2/2✓ Branch 0 taken 353280 times.
✓ Branch 1 taken 176640 times.
|
529920 | for(int32_t j=0; j<3-1; j++) |
| 5567 | { | ||
| 5568 |
2/2✓ Branch 0 taken 529920 times.
✓ Branch 1 taken 353280 times.
|
883200 | for(int32_t k=0; k<2-j; k++) |
| 5569 | { | ||
| 5570 |
2/2✓ Branch 0 taken 21196 times.
✓ Branch 1 taken 508724 times.
|
529920 | if(temp_misc.shop[i].hasitem[k]==0) |
| 5571 | { | ||
| 5572 | 508724 | swaptmp = temp_misc.shop[i].item[k]; | |
| 5573 | 508724 | temp_misc.shop[i].item[k] = temp_misc.shop[i].item[k+1]; | |
| 5574 | 508724 | temp_misc.shop[i].item[k+1] = swaptmp; | |
| 5575 | 508724 | swaptmp = temp_misc.shop[i].price[k]; | |
| 5576 | 508724 | temp_misc.shop[i].price[k] = temp_misc.shop[i].price[k+1]; | |
| 5577 | 508724 | temp_misc.shop[i].price[k+1] = swaptmp; | |
| 5578 | 508724 | swaptmp = temp_misc.shop[i].hasitem[k]; | |
| 5579 | 508724 | temp_misc.shop[i].hasitem[k] = temp_misc.shop[i].hasitem[k+1]; | |
| 5580 | 508724 | temp_misc.shop[i].hasitem[k+1] = swaptmp; | |
| 5581 | 508724 | } | |
| 5582 | 529920 | } | |
| 5583 | 353280 | } | |
| 5584 | 176640 | } | |
| 5585 | |||
| 5586 | //infos | ||
| 5587 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 666 times.
|
690 | if(Header->zelda_version > 0x192) |
| 5588 | { | ||
| 5589 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!p_igetw(&infos,f)) |
| 5590 | { | ||
| 5591 | ✗ | return qe_invalid; | |
| 5592 | } | ||
| 5593 | 666 | } | |
| 5594 | |||
| 5595 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 690 times.
|
690 | if (infos > NUM_INFOS) |
| 5596 | { | ||
| 5597 | ✗ | return qe_invalid; | |
| 5598 | } | ||
| 5599 | |||
| 5600 | |||
| 5601 |
2/2✓ Branch 0 taken 9221 times.
✓ Branch 1 taken 690 times.
|
9911 | for(int32_t i=0; i<infos; i++) |
| 5602 | { | ||
| 5603 |
2/2✓ Branch 0 taken 761 times.
✓ Branch 1 taken 8460 times.
|
9221 | if(s_version > 6) |
| 5604 | { | ||
| 5605 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8460 times.
|
8460 | if(!p_getstr(temp_misc.info[i].name,sizeof(temp_misc.info[i].name)-1,f)) |
| 5606 | { | ||
| 5607 | ✗ | return qe_invalid; | |
| 5608 | } | ||
| 5609 | 8460 | } | |
| 5610 | |||
| 5611 |
2/2✓ Branch 0 taken 27663 times.
✓ Branch 1 taken 9221 times.
|
36884 | for(int32_t j=0; j<3; j++) |
| 5612 | { | ||
| 5613 |
3/4✓ Branch 0 taken 26799 times.
✓ Branch 1 taken 864 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 288 times.
|
27951 | if((Header->zelda_version < 0x192)|| |
| 5614 |
2/2✓ Branch 0 taken 288 times.
✓ Branch 1 taken 26511 times.
|
26799 | ((Header->zelda_version == 0x192)&&(Header->build<146))) |
| 5615 | { | ||
| 5616 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 864 times.
|
864 | if(!p_getc(&tempbyte,f)) |
| 5617 | { | ||
| 5618 | ✗ | return qe_invalid; | |
| 5619 | } | ||
| 5620 | |||
| 5621 | 864 | temp_misc.info[i].str[j]=tempbyte; | |
| 5622 | 864 | } | |
| 5623 | else | ||
| 5624 | { | ||
| 5625 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26799 times.
|
26799 | if(!p_igetw(&temp_misc.info[i].str[j],f)) |
| 5626 | { | ||
| 5627 | ✗ | return qe_invalid; | |
| 5628 | } | ||
| 5629 | } | ||
| 5630 | 27663 | } | |
| 5631 | |||
| 5632 |
2/2✓ Branch 0 taken 8837 times.
✓ Branch 1 taken 384 times.
|
9221 | if(Header->zelda_version < 0x193) |
| 5633 | { | ||
| 5634 |
1/2✓ Branch 0 taken 384 times.
✗ Branch 1 not taken.
|
384 | if(!p_getc(&tempbyte,f)) |
| 5635 | { | ||
| 5636 | ✗ | return qe_invalid; | |
| 5637 | } | ||
| 5638 | 384 | } | |
| 5639 | |||
| 5640 |
3/4✓ Branch 0 taken 96 times.
✓ Branch 1 taken 9125 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 96 times.
|
9221 | if((Header->zelda_version == 0x192)&&(Header->build>145)) |
| 5641 | { | ||
| 5642 |
1/2✓ Branch 0 taken 96 times.
✗ Branch 1 not taken.
|
96 | if(!p_getc(&padding,f)) |
| 5643 | { | ||
| 5644 | ✗ | return qe_invalid; | |
| 5645 | } | ||
| 5646 | 96 | } | |
| 5647 | |||
| 5648 |
2/2✓ Branch 0 taken 27663 times.
✓ Branch 1 taken 9221 times.
|
36884 | for(int32_t j=0; j<3; j++) |
| 5649 | { | ||
| 5650 |
1/2✓ Branch 0 taken 27663 times.
✗ Branch 1 not taken.
|
27663 | if(!p_igetw(&temp_misc.info[i].price[j],f)) |
| 5651 | { | ||
| 5652 | ✗ | return qe_invalid; | |
| 5653 | } | ||
| 5654 | 27663 | } | |
| 5655 | 9221 | } | |
| 5656 | |||
| 5657 | //filter all the 0 strings to the end (yeah, bubble sort; sue me) | ||
| 5658 |
2/2✓ Branch 0 taken 176640 times.
✓ Branch 1 taken 690 times.
|
177330 | for(int32_t i=0; i<maxinfos; ++i) |
| 5659 | { | ||
| 5660 |
2/2✓ Branch 0 taken 353280 times.
✓ Branch 1 taken 176640 times.
|
529920 | for(int32_t j=0; j<3-1; j++) |
| 5661 | { | ||
| 5662 |
2/2✓ Branch 0 taken 529920 times.
✓ Branch 1 taken 353280 times.
|
883200 | for(int32_t k=0; k<2-j; k++) |
| 5663 | { | ||
| 5664 |
2/2✓ Branch 0 taken 10447 times.
✓ Branch 1 taken 519473 times.
|
529920 | if(temp_misc.info[i].str[k]==0) |
| 5665 | { | ||
| 5666 | 519473 | swaptmp = temp_misc.info[i].str[k]; | |
| 5667 | 519473 | temp_misc.info[i].str[k] = temp_misc.info[i].str[k+1]; | |
| 5668 | 519473 | temp_misc.info[i].str[k+1] = swaptmp; | |
| 5669 | 519473 | swaptmp = temp_misc.info[i].price[k]; | |
| 5670 | 519473 | temp_misc.info[i].price[k] = temp_misc.info[i].price[k+1]; | |
| 5671 | 519473 | temp_misc.info[i].price[k+1] = swaptmp; | |
| 5672 | 519473 | } | |
| 5673 | 529920 | } | |
| 5674 | 353280 | } | |
| 5675 | 176640 | } | |
| 5676 | |||
| 5677 | |||
| 5678 | //warp rings | ||
| 5679 |
2/2✓ Branch 0 taken 83 times.
✓ Branch 1 taken 607 times.
|
690 | if(s_version > 5) |
| 5680 | 607 | warprings++; | |
| 5681 | |||
| 5682 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 666 times.
|
690 | if(Header->zelda_version > 0x192) |
| 5683 | { | ||
| 5684 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!p_igetw(&warprings,f)) |
| 5685 | { | ||
| 5686 | ✗ | return qe_invalid; | |
| 5687 | } | ||
| 5688 | |||
| 5689 |
2/2✓ Branch 0 taken 287 times.
✓ Branch 1 taken 379 times.
|
666 | if (warprings > NUM_WARP_RINGS) |
| 5690 | { | ||
| 5691 | // return qe_invalid; | ||
| 5692 | // Note: we can't actually fail here because for some reason, some quest files have more than the max | ||
| 5693 | // number of possible warp rings. Some examples of this are: demosp253.qst, yuurand.qst | ||
| 5694 | // So instead below we disable `keepdata` when reading the bad warp ring data, so no memory is corrupted. | ||
| 5695 | 379 | } | |
| 5696 | 666 | } | |
| 5697 | |||
| 5698 |
2/2✓ Branch 0 taken 7277 times.
✓ Branch 1 taken 690 times.
|
7967 | for(int32_t i=0; i<warprings; i++) |
| 5699 | { | ||
| 5700 | // See above comment on the `warprings` range check. | ||
| 5701 | 7277 | bool keepdata = i < NUM_WARP_RINGS; | |
| 5702 | |||
| 5703 |
2/2✓ Branch 0 taken 64373 times.
✓ Branch 1 taken 7277 times.
|
71650 | for(int32_t j=0; j<8+((s_version > 5)?1:0); j++) |
| 5704 | { | ||
| 5705 |
2/2✓ Branch 0 taken 8960 times.
✓ Branch 1 taken 55413 times.
|
64373 | if(s_version <= 3) |
| 5706 | { | ||
| 5707 |
1/2✓ Branch 0 taken 8960 times.
✗ Branch 1 not taken.
|
8960 | if(!p_getc(&tempbyte,f)) |
| 5708 | { | ||
| 5709 | ✗ | return qe_invalid; | |
| 5710 | } | ||
| 5711 | |||
| 5712 |
2/2✓ Branch 0 taken 3192 times.
✓ Branch 1 taken 5768 times.
|
8960 | if (keepdata) |
| 5713 | 5768 | temp_misc.warp[i].dmap[j]=(word)tempbyte; | |
| 5714 | 8960 | } | |
| 5715 | else | ||
| 5716 | { | ||
| 5717 | word tempword; | ||
| 5718 |
1/2✓ Branch 0 taken 55413 times.
✗ Branch 1 not taken.
|
55413 | if(!p_igetw(&tempword,f)) |
| 5719 | { | ||
| 5720 | ✗ | return qe_invalid; | |
| 5721 | } | ||
| 5722 | |||
| 5723 |
2/2✓ Branch 0 taken 6246 times.
✓ Branch 1 taken 49167 times.
|
55413 | if (keepdata) |
| 5724 | 49167 | temp_misc.warp[i].dmap[j] = tempword; | |
| 5725 | } | ||
| 5726 | 64373 | } | |
| 5727 | |||
| 5728 |
2/2✓ Branch 0 taken 64373 times.
✓ Branch 1 taken 7277 times.
|
71650 | for(int32_t j=0; j<8+((s_version > 5)?1:0); j++) |
| 5729 | { | ||
| 5730 |
1/2✓ Branch 0 taken 64373 times.
✗ Branch 1 not taken.
|
64373 | if(!p_getc(&tempbyte,f)) |
| 5731 | { | ||
| 5732 | ✗ | return qe_invalid; | |
| 5733 | } | ||
| 5734 |
2/2✓ Branch 0 taken 9438 times.
✓ Branch 1 taken 54935 times.
|
64373 | if (keepdata) |
| 5735 | 54935 | temp_misc.warp[i].scr[j] = tempbyte; | |
| 5736 | 64373 | } | |
| 5737 | |||
| 5738 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7277 times.
|
7277 | if(!p_getc(&tempbyte,f)) |
| 5739 | { | ||
| 5740 | ✗ | return qe_invalid; | |
| 5741 | } | ||
| 5742 |
2/2✓ Branch 0 taken 1093 times.
✓ Branch 1 taken 6184 times.
|
7277 | if (keepdata) |
| 5743 | 6184 | temp_misc.warp[i].size = tempbyte; | |
| 5744 | |||
| 5745 |
2/2✓ Branch 0 taken 7085 times.
✓ Branch 1 taken 192 times.
|
7277 | if(Header->zelda_version < 0x193) |
| 5746 | { | ||
| 5747 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 192 times.
|
192 | if(!p_getc(&tempbyte,f)) |
| 5748 | { | ||
| 5749 | ✗ | return qe_invalid; | |
| 5750 | } | ||
| 5751 | 192 | } | |
| 5752 | 7277 | } | |
| 5753 | |||
| 5754 | //palette cycles | ||
| 5755 |
2/2✓ Branch 0 taken 666 times.
✓ Branch 1 taken 24 times.
|
690 | if(Header->zelda_version < 0x193) //in 1.93+, palette cycling is saved with the palettes |
| 5756 | { | ||
| 5757 |
2/2✓ Branch 0 taken 6144 times.
✓ Branch 1 taken 24 times.
|
6168 | for(int32_t i=0; i<256; i++) |
| 5758 | { | ||
| 5759 |
2/2✓ Branch 0 taken 18432 times.
✓ Branch 1 taken 6144 times.
|
24576 | for(int32_t j=0; j<3; j++) |
| 5760 | { | ||
| 5761 | 18432 | temp_misc.cycles[i][j].first=0; | |
| 5762 | 18432 | temp_misc.cycles[i][j].count=0; | |
| 5763 | 18432 | temp_misc.cycles[i][j].speed=0; | |
| 5764 | 18432 | } | |
| 5765 | 6144 | } | |
| 5766 | |||
| 5767 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
30 | if((Header->zelda_version < 0x192)|| |
| 5768 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | ((Header->zelda_version == 0x192)&&(Header->build<73))) |
| 5769 | { | ||
| 5770 | 18 | palcycles=16; | |
| 5771 | 18 | } | |
| 5772 | |||
| 5773 |
2/2✓ Branch 0 taken 1824 times.
✓ Branch 1 taken 24 times.
|
1848 | for(int32_t i=0; i<palcycles; i++) |
| 5774 | { | ||
| 5775 |
2/2✓ Branch 0 taken 5472 times.
✓ Branch 1 taken 1824 times.
|
7296 | for(int32_t j=0; j<3; j++) |
| 5776 | { | ||
| 5777 |
1/2✓ Branch 0 taken 5472 times.
✗ Branch 1 not taken.
|
5472 | if(!p_getc(&temp_misc.cycles[i][j].first,f)) |
| 5778 | { | ||
| 5779 | ✗ | return qe_invalid; | |
| 5780 | } | ||
| 5781 | |||
| 5782 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5472 times.
|
5472 | if(!p_getc(&temp_misc.cycles[i][j].count,f)) |
| 5783 | { | ||
| 5784 | ✗ | return qe_invalid; | |
| 5785 | } | ||
| 5786 | |||
| 5787 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5472 times.
|
5472 | if(!p_getc(&temp_misc.cycles[i][j].speed,f)) |
| 5788 | { | ||
| 5789 | ✗ | return qe_invalid; | |
| 5790 | } | ||
| 5791 | 5472 | } | |
| 5792 | 1824 | } | |
| 5793 | 24 | } | |
| 5794 | |||
| 5795 | //Wind warps are now just another warp ring. | ||
| 5796 |
2/2✓ Branch 0 taken 607 times.
✓ Branch 1 taken 83 times.
|
690 | if(s_version <= 5) |
| 5797 | { | ||
| 5798 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 59 times.
|
83 | if(Header->zelda_version > 0x192) |
| 5799 | { | ||
| 5800 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if(!p_igetw(&windwarps,f)) |
| 5801 | { | ||
| 5802 | ✗ | return qe_invalid; | |
| 5803 | } | ||
| 5804 | 59 | } | |
| 5805 | |||
| 5806 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 83 times.
|
83 | if (windwarps > NUM_WARP_RINGS) |
| 5807 | { | ||
| 5808 | ✗ | return qe_invalid; | |
| 5809 | } | ||
| 5810 | |||
| 5811 |
2/2✓ Branch 0 taken 665 times.
✓ Branch 1 taken 83 times.
|
748 | for(int32_t i=0; i<windwarps; i++) |
| 5812 | { | ||
| 5813 |
1/2✓ Branch 0 taken 665 times.
✗ Branch 1 not taken.
|
665 | if(s_version <= 3) |
| 5814 | { | ||
| 5815 |
1/2✓ Branch 0 taken 665 times.
✗ Branch 1 not taken.
|
665 | if(!p_getc(&tempbyte,f)) |
| 5816 | { | ||
| 5817 | ✗ | return qe_invalid; | |
| 5818 | } | ||
| 5819 | |||
| 5820 | 665 | temp_misc.warp[8].dmap[i]=tempbyte; | |
| 5821 | 665 | } | |
| 5822 | else | ||
| 5823 | { | ||
| 5824 | ✗ | if(!p_igetw(&temp_misc.warp[8].dmap[i],f)) | |
| 5825 | { | ||
| 5826 | ✗ | return qe_invalid; | |
| 5827 | } | ||
| 5828 | } | ||
| 5829 | |||
| 5830 |
1/2✓ Branch 0 taken 665 times.
✗ Branch 1 not taken.
|
665 | if(!p_getc(&temp_misc.warp[8].scr[i],f)) |
| 5831 | { | ||
| 5832 | ✗ | return qe_invalid; | |
| 5833 | } | ||
| 5834 | |||
| 5835 | 665 | temp_misc.warp[8].size = 9; | |
| 5836 | |||
| 5837 |
1/2✓ Branch 0 taken 665 times.
✗ Branch 1 not taken.
|
665 | if(s_version == 5) |
| 5838 | { | ||
| 5839 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 5840 | { | ||
| 5841 | ✗ | return qe_invalid; | |
| 5842 | } | ||
| 5843 | ✗ | } | |
| 5844 | 665 | } | |
| 5845 | 83 | } | |
| 5846 | |||
| 5847 | |||
| 5848 | //triforce pieces | ||
| 5849 |
2/2✓ Branch 0 taken 5520 times.
✓ Branch 1 taken 690 times.
|
6210 | for(int32_t i=0; i<triforces; i++) |
| 5850 | { | ||
| 5851 |
1/2✓ Branch 0 taken 5520 times.
✗ Branch 1 not taken.
|
5520 | if(!p_getc(&temp_misc.triforce[i],f)) |
| 5852 | { | ||
| 5853 | ✗ | return qe_invalid; | |
| 5854 | } | ||
| 5855 | 5520 | } | |
| 5856 | |||
| 5857 | //misc color data | ||
| 5858 |
2/2✓ Branch 0 taken 607 times.
✓ Branch 1 taken 83 times.
|
690 | if(s_version<3) |
| 5859 | { | ||
| 5860 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.text,f)) |
| 5861 | { | ||
| 5862 | ✗ | return qe_invalid; | |
| 5863 | } | ||
| 5864 | |||
| 5865 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.caption,f)) |
| 5866 | { | ||
| 5867 | ✗ | return qe_invalid; | |
| 5868 | } | ||
| 5869 | |||
| 5870 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.overw_bg,f)) |
| 5871 | { | ||
| 5872 | ✗ | return qe_invalid; | |
| 5873 | } | ||
| 5874 | |||
| 5875 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.dngn_bg,f)) |
| 5876 | { | ||
| 5877 | ✗ | return qe_invalid; | |
| 5878 | } | ||
| 5879 | |||
| 5880 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.dngn_fg,f)) |
| 5881 | { | ||
| 5882 | ✗ | return qe_invalid; | |
| 5883 | } | ||
| 5884 | |||
| 5885 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.cave_fg,f)) |
| 5886 | { | ||
| 5887 | ✗ | return qe_invalid; | |
| 5888 | } | ||
| 5889 | |||
| 5890 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.bs_dk,f)) |
| 5891 | { | ||
| 5892 | ✗ | return qe_invalid; | |
| 5893 | } | ||
| 5894 | |||
| 5895 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.bs_goal,f)) |
| 5896 | { | ||
| 5897 | ✗ | return qe_invalid; | |
| 5898 | } | ||
| 5899 | |||
| 5900 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.compass_lt,f)) |
| 5901 | { | ||
| 5902 | ✗ | return qe_invalid; | |
| 5903 | } | ||
| 5904 | |||
| 5905 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.compass_dk,f)) |
| 5906 | { | ||
| 5907 | ✗ | return qe_invalid; | |
| 5908 | } | ||
| 5909 | |||
| 5910 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.subscr_bg,f)) |
| 5911 | { | ||
| 5912 | ✗ | return qe_invalid; | |
| 5913 | } | ||
| 5914 | |||
| 5915 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.triframe_color,f)) |
| 5916 | { | ||
| 5917 | ✗ | return qe_invalid; | |
| 5918 | } | ||
| 5919 | |||
| 5920 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.hero_dot,f)) |
| 5921 | { | ||
| 5922 | ✗ | return qe_invalid; | |
| 5923 | } | ||
| 5924 | |||
| 5925 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.bmap_bg,f)) |
| 5926 | { | ||
| 5927 | ✗ | return qe_invalid; | |
| 5928 | } | ||
| 5929 | |||
| 5930 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.bmap_fg,f)) |
| 5931 | { | ||
| 5932 | ✗ | return qe_invalid; | |
| 5933 | } | ||
| 5934 | |||
| 5935 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.triforce_cset,f)) |
| 5936 | { | ||
| 5937 | ✗ | return qe_invalid; | |
| 5938 | } | ||
| 5939 | |||
| 5940 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.triframe_cset,f)) |
| 5941 | { | ||
| 5942 | ✗ | return qe_invalid; | |
| 5943 | } | ||
| 5944 | |||
| 5945 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.overworld_map_cset,f)) |
| 5946 | { | ||
| 5947 | ✗ | return qe_invalid; | |
| 5948 | } | ||
| 5949 | |||
| 5950 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.dungeon_map_cset,f)) |
| 5951 | { | ||
| 5952 | ✗ | return qe_invalid; | |
| 5953 | } | ||
| 5954 | |||
| 5955 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.blueframe_cset,f)) |
| 5956 | { | ||
| 5957 | ✗ | return qe_invalid; | |
| 5958 | } | ||
| 5959 | |||
| 5960 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_igetw(&temp_misc.colors.triforce_tile,f)) |
| 5961 | { | ||
| 5962 | ✗ | return qe_invalid; | |
| 5963 | } | ||
| 5964 | |||
| 5965 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_igetw(&temp_misc.colors.triframe_tile,f)) |
| 5966 | { | ||
| 5967 | ✗ | return qe_invalid; | |
| 5968 | } | ||
| 5969 | |||
| 5970 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_igetw(&temp_misc.colors.overworld_map_tile,f)) |
| 5971 | { | ||
| 5972 | ✗ | return qe_invalid; | |
| 5973 | } | ||
| 5974 | |||
| 5975 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_igetw(&temp_misc.colors.dungeon_map_tile,f)) |
| 5976 | { | ||
| 5977 | ✗ | return qe_invalid; | |
| 5978 | } | ||
| 5979 | |||
| 5980 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_igetw(&temp_misc.colors.blueframe_tile,f)) |
| 5981 | { | ||
| 5982 | ✗ | return qe_invalid; | |
| 5983 | } | ||
| 5984 | |||
| 5985 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_igetw(&temp_misc.colors.HCpieces_tile,f)) |
| 5986 | { | ||
| 5987 | ✗ | return qe_invalid; | |
| 5988 | } | ||
| 5989 | |||
| 5990 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.HCpieces_cset,f)) |
| 5991 | { | ||
| 5992 | ✗ | return qe_invalid; | |
| 5993 | } | ||
| 5994 | |||
| 5995 | 83 | temp_misc.colors.msgtext = 0x01; | |
| 5996 | |||
| 5997 |
2/2✓ Branch 0 taken 59 times.
✓ Branch 1 taken 24 times.
|
83 | if(Header->zelda_version < 0x193) |
| 5998 | { | ||
| 5999 |
2/2✓ Branch 0 taken 168 times.
✓ Branch 1 taken 24 times.
|
192 | for(int32_t i=0; i<7; i++) |
| 6000 | { | ||
| 6001 |
1/2✓ Branch 0 taken 168 times.
✗ Branch 1 not taken.
|
168 | if(!p_getc(&tempbyte,f)) |
| 6002 | { | ||
| 6003 | ✗ | return qe_invalid; | |
| 6004 | } | ||
| 6005 | 168 | } | |
| 6006 | 24 | } | |
| 6007 | |||
| 6008 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 77 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
83 | if((Header->zelda_version == 0x192)&&(Header->build>145)) |
| 6009 | { | ||
| 6010 |
2/2✓ Branch 0 taken 1536 times.
✓ Branch 1 taken 6 times.
|
1542 | for(int32_t i=0; i<256; i++) |
| 6011 | { | ||
| 6012 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1536 times.
|
1536 | if(!p_getc(&tempbyte,f)) |
| 6013 | { | ||
| 6014 | ✗ | return qe_invalid; | |
| 6015 | } | ||
| 6016 | 1536 | } | |
| 6017 | 6 | } | |
| 6018 | |||
| 6019 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(s_version>1) |
| 6020 | { | ||
| 6021 | ✗ | if(!p_getc(&temp_misc.colors.subscr_shadow,f)) | |
| 6022 | { | ||
| 6023 | ✗ | return qe_invalid; | |
| 6024 | } | ||
| 6025 | ✗ | } | |
| 6026 | |||
| 6027 | //save game icons | ||
| 6028 |
3/4✓ Branch 0 taken 65 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
89 | if((Header->zelda_version < 0x192)|| |
| 6029 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 59 times.
|
65 | ((Header->zelda_version == 0x192)&&(Header->build<73))) |
| 6030 | { | ||
| 6031 | 18 | icons=3; | |
| 6032 | 18 | } | |
| 6033 | |||
| 6034 |
2/2✓ Branch 0 taken 314 times.
✓ Branch 1 taken 83 times.
|
397 | for(int32_t i=0; i<icons; i++) |
| 6035 | { | ||
| 6036 |
1/2✓ Branch 0 taken 314 times.
✗ Branch 1 not taken.
|
314 | if(!p_igetw(&temp_misc.icons[i],f)) |
| 6037 | { | ||
| 6038 | ✗ | return qe_invalid; | |
| 6039 | } | ||
| 6040 | 314 | } | |
| 6041 | 83 | } | |
| 6042 | |||
| 6043 |
3/4✓ Branch 0 taken 672 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
696 | if((Header->zelda_version < 0x192)|| |
| 6044 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 666 times.
|
672 | ((Header->zelda_version == 0x192)&&(Header->build<30))) |
| 6045 | { | ||
| 6046 | 18 | memcpy(Misc, &temp_misc, sizeof(temp_misc)); | |
| 6047 | |||
| 6048 | 18 | return 0; | |
| 6049 | } | ||
| 6050 | |||
| 6051 | //pond information | ||
| 6052 |
2/2✓ Branch 0 taken 666 times.
✓ Branch 1 taken 6 times.
|
672 | if(Header->zelda_version < 0x193) |
| 6053 | { | ||
| 6054 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | if((Header->zelda_version == 0x192)&&(Header->build<146)) |
| 6055 | { | ||
| 6056 | ✗ | pondsize=25; | |
| 6057 | ✗ | } | |
| 6058 | |||
| 6059 |
2/2✓ Branch 0 taken 96 times.
✓ Branch 1 taken 6 times.
|
102 | for(int32_t i=0; i<ponds; i++) |
| 6060 | { | ||
| 6061 |
2/2✓ Branch 0 taken 6912 times.
✓ Branch 1 taken 96 times.
|
7008 | for(int32_t j=0; j<pondsize; j++) |
| 6062 | { | ||
| 6063 |
1/2✓ Branch 0 taken 6912 times.
✗ Branch 1 not taken.
|
6912 | if(!p_getc(&tempbyte,f)) |
| 6064 | { | ||
| 6065 | ✗ | return qe_invalid; | |
| 6066 | |||
| 6067 | } | ||
| 6068 | 6912 | } | |
| 6069 | 96 | } | |
| 6070 | 6 | } | |
| 6071 | |||
| 6072 | //end string | ||
| 6073 |
2/4✓ Branch 0 taken 672 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
678 | if((Header->zelda_version < 0x192)|| |
| 6074 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 666 times.
|
672 | ((Header->zelda_version == 0x192)&&(Header->build<146))) |
| 6075 | { | ||
| 6076 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 6077 | { | ||
| 6078 | ✗ | return qe_invalid; | |
| 6079 | } | ||
| 6080 | |||
| 6081 | ✗ | temp_misc.endstring=tempbyte; | |
| 6082 | |||
| 6083 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 6084 | { | ||
| 6085 | ✗ | return qe_invalid; | |
| 6086 | } | ||
| 6087 | ✗ | } | |
| 6088 | else | ||
| 6089 | { | ||
| 6090 |
1/2✓ Branch 0 taken 672 times.
✗ Branch 1 not taken.
|
672 | if(!p_igetw(&temp_misc.endstring,f)) |
| 6091 | { | ||
| 6092 | ✗ | return qe_invalid; | |
| 6093 | } | ||
| 6094 | } | ||
| 6095 | |||
| 6096 | //expansion | ||
| 6097 |
2/2✓ Branch 0 taken 666 times.
✓ Branch 1 taken 6 times.
|
672 | if(Header->zelda_version < 0x193) |
| 6098 | { | ||
| 6099 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | if((Header->zelda_version == 0x192)&&(Header->build<73)) |
| 6100 | { | ||
| 6101 | ✗ | expansionsize=99*2; | |
| 6102 | ✗ | } | |
| 6103 | |||
| 6104 |
2/2✓ Branch 0 taken 1176 times.
✓ Branch 1 taken 6 times.
|
1182 | for(int32_t i=0; i<expansionsize; i++) |
| 6105 | { | ||
| 6106 |
1/2✓ Branch 0 taken 1176 times.
✗ Branch 1 not taken.
|
1176 | if(!p_getc(&tempbyte,f)) |
| 6107 | { | ||
| 6108 | ✗ | return qe_invalid; | |
| 6109 | } | ||
| 6110 | 1176 | } | |
| 6111 | 6 | } | |
| 6112 | //shops v8 | ||
| 6113 | |||
| 6114 | |||
| 6115 |
2/2✓ Branch 0 taken 529 times.
✓ Branch 1 taken 143 times.
|
672 | if(s_version >= 8) |
| 6116 | { | ||
| 6117 |
2/2✓ Branch 0 taken 2112 times.
✓ Branch 1 taken 143 times.
|
2255 | for(int32_t i=0; i<shops; i++) |
| 6118 | { | ||
| 6119 |
2/2✓ Branch 0 taken 6336 times.
✓ Branch 1 taken 2112 times.
|
8448 | for(int32_t j=0; j<3; j++) |
| 6120 | { | ||
| 6121 |
1/2✓ Branch 0 taken 6336 times.
✗ Branch 1 not taken.
|
6336 | if(!p_igetw(&temp_misc.shop[i].str[j],f)) |
| 6122 | ✗ | return qe_invalid; | |
| 6123 | 6336 | } | |
| 6124 | 2112 | } | |
| 6125 | 143 | } | |
| 6126 | |||
| 6127 | 672 | memset(&temp_misc.questmisc, 0, sizeof(int32_t)*32); | |
| 6128 | 672 | memset(&temp_misc.zscript_last_compiled_version, 0, sizeof(int32_t)); | |
| 6129 | |||
| 6130 | //v9 includes quest misc[32] | ||
| 6131 | // ... this has been deprecated (2024) | ||
| 6132 |
2/2✓ Branch 0 taken 529 times.
✓ Branch 1 taken 143 times.
|
672 | if(s_version >= 9) |
| 6133 | { | ||
| 6134 |
2/2✓ Branch 0 taken 4576 times.
✓ Branch 1 taken 143 times.
|
4719 | for ( int32_t q = 0; q < 32; q++ ) |
| 6135 | { | ||
| 6136 |
1/2✓ Branch 0 taken 4576 times.
✗ Branch 1 not taken.
|
4576 | if(!p_igetl(&temp_misc.questmisc[q],f)) |
| 6137 | ✗ | return qe_invalid; | |
| 6138 | 4576 | } | |
| 6139 | // this was string labels | ||
| 6140 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 143 times.
|
143 | if (pack_fseek(f, 32 * 128)) |
| 6141 | ✗ | return qe_invalid; | |
| 6142 | 143 | } | |
| 6143 | |||
| 6144 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 529 times.
|
672 | if(s_version >= 11 ) |
| 6145 | { | ||
| 6146 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_igetl(&temp_misc.zscript_last_compiled_version,f)) |
| 6147 | ✗ | return qe_invalid; | |
| 6148 | 143 | } | |
| 6149 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 529 times.
|
529 | else if(s_version < 11 ) |
| 6150 | { | ||
| 6151 | 529 | temp_misc.zscript_last_compiled_version = -1; | |
| 6152 | 529 | } | |
| 6153 | |||
| 6154 | 672 | FFCore.quest_format[vLastCompile] = temp_misc.zscript_last_compiled_version; | |
| 6155 | |||
| 6156 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 529 times.
|
672 | if(s_version >= 12) |
| 6157 | { | ||
| 6158 | byte spr; | ||
| 6159 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 143 times.
|
36751 | for(int32_t q = 0; q < sprMAX; ++q) |
| 6160 | { | ||
| 6161 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if(!p_getc(&spr,f)) |
| 6162 | ✗ | return qe_invalid; | |
| 6163 | 36608 | temp_misc.sprites[q] = spr; | |
| 6164 | 36608 | } | |
| 6165 | 143 | } | |
| 6166 | else | ||
| 6167 | { | ||
| 6168 | 529 | memset(&(temp_misc.sprites), 0, sizeof(temp_misc.sprites)); | |
| 6169 | //temp_misc.sprites[sprFALL] = ; | ||
| 6170 | } | ||
| 6171 | |||
| 6172 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 529 times.
|
672 | if(s_version >= 13) |
| 6173 | { | ||
| 6174 |
2/2✓ Branch 0 taken 9152 times.
✓ Branch 1 taken 143 times.
|
9295 | for(size_t q = 0; q < 64; ++q) |
| 6175 | { | ||
| 6176 | 9152 | bottletype* bt = &(temp_misc.bottle_types[q]); | |
| 6177 |
1/2✓ Branch 0 taken 9152 times.
✗ Branch 1 not taken.
|
9152 | if (!p_getstr(bt->name, sizeof(bt->name)-1, f)) |
| 6178 | ✗ | return qe_invalid; | |
| 6179 |
2/2✓ Branch 0 taken 27456 times.
✓ Branch 1 taken 9152 times.
|
36608 | for(size_t j = 0; j < 3; ++j) |
| 6180 | { | ||
| 6181 |
1/2✓ Branch 0 taken 27456 times.
✗ Branch 1 not taken.
|
27456 | if (!p_getc(&(bt->counter[j]), f)) |
| 6182 | ✗ | return qe_invalid; | |
| 6183 |
1/2✓ Branch 0 taken 27456 times.
✗ Branch 1 not taken.
|
27456 | if (!p_igetw(&(bt->amount[j]), f)) |
| 6184 | ✗ | return qe_invalid; | |
| 6185 | 27456 | } | |
| 6186 |
1/2✓ Branch 0 taken 9152 times.
✗ Branch 1 not taken.
|
9152 | if (!p_getc(&(bt->flags), f)) |
| 6187 | ✗ | return qe_invalid; | |
| 6188 |
1/2✓ Branch 0 taken 9152 times.
✗ Branch 1 not taken.
|
9152 | if (!p_getc(&(bt->next_type), f)) |
| 6189 | ✗ | return qe_invalid; | |
| 6190 | 9152 | } | |
| 6191 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 143 times.
|
36751 | for(size_t q = 0; q < 256; ++q) |
| 6192 | { | ||
| 6193 | 36608 | bottleshoptype* bst = &(temp_misc.bottle_shop_types[q]); | |
| 6194 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if (!pfread(bst->name, sizeof(bst->name)-1, f)) |
| 6195 | ✗ | return qe_invalid; | |
| 6196 |
2/2✓ Branch 0 taken 109824 times.
✓ Branch 1 taken 36608 times.
|
146432 | for(size_t j = 0; j < 3; ++j) |
| 6197 | { | ||
| 6198 |
1/2✓ Branch 0 taken 109824 times.
✗ Branch 1 not taken.
|
109824 | if (!p_getc(&(bst->fill[j]), f)) |
| 6199 | ✗ | return qe_invalid; | |
| 6200 |
1/2✓ Branch 0 taken 109824 times.
✗ Branch 1 not taken.
|
109824 | if (!p_igetw(&(bst->comb[j]), f)) |
| 6201 | ✗ | return qe_invalid; | |
| 6202 |
1/2✓ Branch 0 taken 109824 times.
✗ Branch 1 not taken.
|
109824 | if (!p_getc(&(bst->cset[j]), f)) |
| 6203 | ✗ | return qe_invalid; | |
| 6204 |
1/2✓ Branch 0 taken 109824 times.
✗ Branch 1 not taken.
|
109824 | if (!p_igetw(&(bst->price[j]), f)) |
| 6205 | ✗ | return qe_invalid; | |
| 6206 |
1/2✓ Branch 0 taken 109824 times.
✗ Branch 1 not taken.
|
109824 | if (!p_igetw(&(bst->str[j]), f)) |
| 6207 | ✗ | return qe_invalid; | |
| 6208 | 109824 | } | |
| 6209 | 36608 | } | |
| 6210 | 143 | } | |
| 6211 | else | ||
| 6212 | { | ||
| 6213 |
2/2✓ Branch 0 taken 33856 times.
✓ Branch 1 taken 529 times.
|
34385 | for(size_t q = 0; q < 64; ++q) |
| 6214 | 33856 | temp_misc.bottle_types[q].clear(); | |
| 6215 |
2/2✓ Branch 0 taken 135424 times.
✓ Branch 1 taken 529 times.
|
135953 | for(size_t q = 0; q < 256; ++q) |
| 6216 | 135424 | temp_misc.bottle_shop_types[q].clear(); | |
| 6217 | } | ||
| 6218 | |||
| 6219 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 529 times.
|
672 | if(s_version >= 14) |
| 6220 | { | ||
| 6221 | byte msfx; | ||
| 6222 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 143 times.
|
36751 | for(int32_t q = 0; q < sfxMAX; ++q) |
| 6223 | { | ||
| 6224 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if(!p_getc(&msfx,f)) |
| 6225 | ✗ | return qe_invalid; | |
| 6226 | 36608 | temp_misc.miscsfx[q] = msfx; | |
| 6227 | 36608 | } | |
| 6228 | 143 | } | |
| 6229 | else | ||
| 6230 | { | ||
| 6231 | 529 | memset(&(temp_misc.miscsfx), 0, sizeof(temp_misc.miscsfx)); | |
| 6232 | 529 | temp_misc.miscsfx[sfxBUSHGRASS] = WAV_ZN1GRASSCUT; | |
| 6233 | 529 | temp_misc.miscsfx[sfxLOWHEART] = WAV_ER; | |
| 6234 | } | ||
| 6235 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 529 times.
|
672 | if(s_version < 15) |
| 6236 | { | ||
| 6237 | 529 | temp_misc.miscsfx[sfxHURTPLAYER] = WAV_OUCH; | |
| 6238 | 529 | temp_misc.miscsfx[sfxHAMMERPOUND] = WAV_ZN1HAMMERPOST; | |
| 6239 | 529 | temp_misc.miscsfx[sfxSUBSCR_ITEM_ASSIGN] = WAV_PLACE; | |
| 6240 | 529 | temp_misc.miscsfx[sfxSUBSCR_CURSOR_MOVE] = WAV_CHIME; | |
| 6241 | 529 | temp_misc.miscsfx[sfxREFILL] = WAV_MSG; | |
| 6242 | 529 | temp_misc.miscsfx[sfxDRAIN] = WAV_MSG; | |
| 6243 | 529 | } | |
| 6244 |
2/2✓ Branch 0 taken 126 times.
✓ Branch 1 taken 546 times.
|
672 | if(s_version < 16) |
| 6245 | { | ||
| 6246 | 546 | temp_misc.miscsfx[sfxTAP] = WAV_ZN1TAP; | |
| 6247 | 546 | temp_misc.miscsfx[sfxTAP_HOLLOW] = WAV_ZN1TAP2; | |
| 6248 | 546 | } | |
| 6249 | |||
| 6250 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 671 times.
|
672 | if (!should_skip) |
| 6251 | 671 | memcpy(Misc, &temp_misc, sizeof(temp_misc)); | |
| 6252 | |||
| 6253 | 672 | return 0; | |
| 6254 | 690 | } | |
| 6255 | |||
| 6256 | extern char *item_string[MAXITEMS]; | ||
| 6257 | extern const char *old_item_string[iLast]; | ||
| 6258 | extern char *weapon_string[MAXWPNS]; | ||
| 6259 | extern const char *old_weapon_string[wLast]; | ||
| 6260 | |||
| 6261 | 415 | int32_t readitems(PACKFILE *f, word version, word build) | |
| 6262 | { | ||
| 6263 |
2/2✓ Branch 0 taken 391 times.
✓ Branch 1 taken 24 times.
|
415 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_items); |
| 6264 | |||
| 6265 | byte padding; | ||
| 6266 | int32_t dummy; | ||
| 6267 | 415 | word items_to_read=MAXITEMS; | |
| 6268 | itemdata tempitem; | ||
| 6269 | 415 | word s_version=0, s_cversion=0; | |
| 6270 | word dummy_word; | ||
| 6271 | |||
| 6272 |
2/2✓ Branch 0 taken 409 times.
✓ Branch 1 taken 6 times.
|
415 | if(version < 0x186) |
| 6273 | { | ||
| 6274 | 6 | items_to_read=64; | |
| 6275 | 6 | } | |
| 6276 | |||
| 6277 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 391 times.
|
415 | if(version > 0x192) |
| 6278 | { | ||
| 6279 | 391 | items_to_read=0; | |
| 6280 | |||
| 6281 | //section version info | ||
| 6282 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | if(!p_igetw(&s_version,f)) |
| 6283 | { | ||
| 6284 | ✗ | return qe_invalid; | |
| 6285 | } | ||
| 6286 | |||
| 6287 | 391 | FFCore.quest_format[vItems] = s_version; | |
| 6288 | |||
| 6289 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | if(!p_igetw(&s_cversion,f)) |
| 6290 | { | ||
| 6291 | ✗ | return qe_invalid; | |
| 6292 | } | ||
| 6293 | |||
| 6294 | //section size | ||
| 6295 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | if(!p_igetl(&dummy,f)) |
| 6296 | { | ||
| 6297 | ✗ | return qe_invalid; | |
| 6298 | } | ||
| 6299 | |||
| 6300 | //finally... section data | ||
| 6301 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | if(!p_igetw(&items_to_read,f)) |
| 6302 | { | ||
| 6303 | ✗ | return qe_invalid; | |
| 6304 | } | ||
| 6305 | |||
| 6306 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
|
391 | if (items_to_read > MAXITEMS) |
| 6307 | { | ||
| 6308 | ✗ | return qe_invalid; | |
| 6309 | } | ||
| 6310 | 391 | } | |
| 6311 | |||
| 6312 |
2/2✓ Branch 0 taken 332 times.
✓ Branch 1 taken 83 times.
|
415 | if(s_version>1) |
| 6313 | { | ||
| 6314 |
2/2✓ Branch 0 taken 84992 times.
✓ Branch 1 taken 332 times.
|
85324 | for(int32_t i=0; i<items_to_read; i++) |
| 6315 | { | ||
| 6316 | char tempname[64]; | ||
| 6317 | |||
| 6318 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if(!pfread(tempname, 64, f)) |
| 6319 | { | ||
| 6320 | ✗ | return qe_invalid; | |
| 6321 | } | ||
| 6322 | |||
| 6323 | 84992 | item_string[i][0] = '\0'; | |
| 6324 | 84992 | strncat(item_string[i], tempname, 64 - 1); | |
| 6325 | 84992 | } | |
| 6326 | 332 | } | |
| 6327 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 82 times.
|
83 | else if (!should_skip) |
| 6328 | { | ||
| 6329 |
2/2✓ Branch 0 taken 20992 times.
✓ Branch 1 taken 82 times.
|
21074 | for(int32_t i=0; i<MAXITEMS; i++) |
| 6330 | { | ||
| 6331 | 20992 | reset_itemname(i); | |
| 6332 | 20992 | } | |
| 6333 | 82 | } | |
| 6334 | |||
| 6335 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 414 times.
|
415 | if (!should_skip) |
| 6336 |
2/2✓ Branch 0 taken 105984 times.
✓ Branch 1 taken 414 times.
|
106398 | for(int32_t i=0; i<MAXITEMS; i++) |
| 6337 | { | ||
| 6338 | 105984 | itemdata& id = itemsbuf[i]; | |
| 6339 | 105984 | memset(&id, 0, sizeof(itemdata)); | |
| 6340 | 105984 | id.count=-1; | |
| 6341 | 105984 | id.playsound=WAV_SCALE; | |
| 6342 | 105984 | reset_itembuf(&id,i); | |
| 6343 | 106398 | } | |
| 6344 | |||
| 6345 |
2/2✓ Branch 0 taken 94114 times.
✓ Branch 1 taken 415 times.
|
94529 | for(int32_t i=0; i<items_to_read; i++) |
| 6346 | { | ||
| 6347 | 94114 | memset(&tempitem, 0, sizeof(itemdata)); | |
| 6348 | 94114 | reset_itembuf(&tempitem,i); | |
| 6349 | |||
| 6350 | |||
| 6351 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 57506 times.
|
94114 | if ( s_version > 35 ) //expanded tiles |
| 6352 | { | ||
| 6353 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if(!p_igetl(&tempitem.tile,f)) |
| 6354 | { | ||
| 6355 | ✗ | return qe_invalid; | |
| 6356 | } | ||
| 6357 | 36608 | } | |
| 6358 | else | ||
| 6359 | { | ||
| 6360 |
1/2✓ Branch 0 taken 57506 times.
✗ Branch 1 not taken.
|
57506 | if(!p_igetw(&tempitem.tile,f)) |
| 6361 | { | ||
| 6362 | ✗ | return qe_invalid; | |
| 6363 | } | ||
| 6364 | } | ||
| 6365 | |||
| 6366 |
1/2✓ Branch 0 taken 94114 times.
✗ Branch 1 not taken.
|
94114 | if(!p_getc(&tempitem.misc_flags,f)) |
| 6367 | { | ||
| 6368 | ✗ | return qe_invalid; | |
| 6369 | } | ||
| 6370 | |||
| 6371 |
1/2✓ Branch 0 taken 94114 times.
✗ Branch 1 not taken.
|
94114 | if(!p_getc(&tempitem.csets,f)) |
| 6372 | { | ||
| 6373 | ✗ | return qe_invalid; | |
| 6374 | } | ||
| 6375 | |||
| 6376 |
1/2✓ Branch 0 taken 94114 times.
✗ Branch 1 not taken.
|
94114 | if(!p_getc(&tempitem.frames,f)) |
| 6377 | { | ||
| 6378 | ✗ | return qe_invalid; | |
| 6379 | } | ||
| 6380 | |||
| 6381 |
1/2✓ Branch 0 taken 94114 times.
✗ Branch 1 not taken.
|
94114 | if(!p_getc(&tempitem.speed,f)) |
| 6382 | { | ||
| 6383 | ✗ | return qe_invalid; | |
| 6384 | } | ||
| 6385 | |||
| 6386 |
1/2✓ Branch 0 taken 94114 times.
✗ Branch 1 not taken.
|
94114 | if(!p_getc(&tempitem.delay,f)) |
| 6387 | { | ||
| 6388 | ✗ | return qe_invalid; | |
| 6389 | } | ||
| 6390 | |||
| 6391 |
2/2✓ Branch 0 taken 89122 times.
✓ Branch 1 taken 4992 times.
|
94114 | if(version < 0x193) |
| 6392 | { | ||
| 6393 |
1/2✓ Branch 0 taken 4992 times.
✗ Branch 1 not taken.
|
4992 | if(!p_getc(&padding,f)) |
| 6394 | { | ||
| 6395 | ✗ | return qe_invalid; | |
| 6396 | } | ||
| 6397 | |||
| 6398 |
4/6✓ Branch 0 taken 1536 times.
✓ Branch 1 taken 3456 times.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1536 times.
✗ Branch 5 not taken.
|
4992 | if((version < 0x192)||((version == 0x192)&&(build<186))) |
| 6399 | { | ||
| 6400 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 4736 times.
|
4992 | if (should_skip) |
| 6401 | 256 | continue; | |
| 6402 | |||
| 6403 |
3/3✓ Branch 0 taken 4690 times.
✓ Branch 1 taken 23 times.
✓ Branch 2 taken 23 times.
|
4736 | switch(i) |
| 6404 | { | ||
| 6405 | case iShield: | ||
| 6406 | 23 | tempitem.ltm=get_qr(qr_BSZELDA)?-12:10; | |
| 6407 | 23 | break; | |
| 6408 | |||
| 6409 | case iMShield: | ||
| 6410 | 23 | tempitem.ltm=get_qr(qr_BSZELDA)?-6:-10; | |
| 6411 | 23 | break; | |
| 6412 | |||
| 6413 | default: | ||
| 6414 | 4690 | tempitem.ltm=0; | |
| 6415 | 4690 | break; | |
| 6416 | } | ||
| 6417 | |||
| 6418 | 4736 | tempitem.count=-1; | |
| 6419 | 4736 | tempitem.flags=item_none; | |
| 6420 | 4736 | tempitem.wpn=tempitem.wpn2=tempitem.wpn3=tempitem.wpn3=tempitem.pickup_hearts= | |
| 6421 | 4736 | tempitem.misc1=tempitem.misc2=tempitem.usesound=0; | |
| 6422 | 4736 | tempitem.family=0xFF; | |
| 6423 | 4736 | tempitem.playsound=WAV_SCALE; | |
| 6424 | 4736 | reset_itembuf(&tempitem,i); | |
| 6425 | |||
| 6426 | 4736 | memcpy(&itemsbuf[i], &tempitem, sizeof(itemdata)); | |
| 6427 | |||
| 6428 | 4736 | continue; | |
| 6429 | } | ||
| 6430 | ✗ | } | |
| 6431 | |||
| 6432 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 89122 times.
|
89122 | if(!p_igetl(&tempitem.ltm,f)) |
| 6433 | { | ||
| 6434 | ✗ | return qe_invalid; | |
| 6435 | } | ||
| 6436 | |||
| 6437 |
1/2✓ Branch 0 taken 89122 times.
✗ Branch 1 not taken.
|
89122 | if(version < 0x193) |
| 6438 | { | ||
| 6439 | ✗ | for(int32_t q=0; q<12; q++) | |
| 6440 | { | ||
| 6441 | ✗ | if(!p_getc(&padding,f)) | |
| 6442 | { | ||
| 6443 | ✗ | return qe_invalid; | |
| 6444 | } | ||
| 6445 | ✗ | } | |
| 6446 | ✗ | } | |
| 6447 | |||
| 6448 |
2/2✓ Branch 0 taken 84992 times.
✓ Branch 1 taken 4130 times.
|
89122 | if(s_version>1) |
| 6449 | { | ||
| 6450 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 48384 times.
|
84992 | if ( s_version >= 31 ) |
| 6451 | { | ||
| 6452 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36608 times.
|
36608 | if(!p_igetl(&tempitem.family,f)) |
| 6453 | { | ||
| 6454 | ✗ | return qe_invalid; | |
| 6455 | } | ||
| 6456 | 36608 | } | |
| 6457 | else | ||
| 6458 | { | ||
| 6459 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48384 times.
|
48384 | if(!p_getc(&tempitem.family,f)) |
| 6460 | { | ||
| 6461 | ✗ | return qe_invalid; | |
| 6462 | } | ||
| 6463 | } | ||
| 6464 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if(s_version < 16) |
| 6465 | ✗ | if(tempitem.family == 0xFF) | |
| 6466 | ✗ | tempitem.family = itype_misc; | |
| 6467 | |||
| 6468 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if(!p_getc(&tempitem.fam_type,f)) |
| 6469 | { | ||
| 6470 | ✗ | return qe_invalid; | |
| 6471 | } | ||
| 6472 | |||
| 6473 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if(s_version>5) |
| 6474 | { | ||
| 6475 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 48384 times.
|
84992 | if(s_version>=31) |
| 6476 | { | ||
| 6477 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36608 times.
|
36608 | if(!p_igetl(&tempitem.power,f)) |
| 6478 | { | ||
| 6479 | ✗ | return qe_invalid; | |
| 6480 | } | ||
| 6481 | 36608 | } | |
| 6482 | else | ||
| 6483 | { | ||
| 6484 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48384 times.
|
48384 | if(!p_getc(&tempitem.power,f)) |
| 6485 | { | ||
| 6486 | ✗ | return qe_invalid; | |
| 6487 | } | ||
| 6488 | } | ||
| 6489 | |||
| 6490 | //converted flags from 16b to 32b -Z | ||
| 6491 |
2/2✓ Branch 0 taken 48384 times.
✓ Branch 1 taken 36608 times.
|
84992 | if ( s_version < 41 ) |
| 6492 | { | ||
| 6493 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48384 times.
|
48384 | if(!p_igetw(&tempitem.flags,f)) |
| 6494 | { | ||
| 6495 | ✗ | return qe_invalid; | |
| 6496 | } | ||
| 6497 | 48384 | } | |
| 6498 | else | ||
| 6499 | { | ||
| 6500 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if(!p_igetl(&tempitem.flags,f)) |
| 6501 | { | ||
| 6502 | ✗ | return qe_invalid; | |
| 6503 | } | ||
| 6504 | } | ||
| 6505 | 84992 | } | |
| 6506 | else | ||
| 6507 | { | ||
| 6508 | //tempitem.power = tempitem.fam_type; | ||
| 6509 | char tempchar; | ||
| 6510 | |||
| 6511 | ✗ | if(!p_getc(&tempchar,f)) | |
| 6512 | { | ||
| 6513 | ✗ | return qe_invalid; | |
| 6514 | } | ||
| 6515 | |||
| 6516 | ✗ | if (tempchar) tempitem.flags |= item_gamedata; | |
| 6517 | } | ||
| 6518 | |||
| 6519 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 84992 times.
|
84992 | if(!p_igetw(&tempitem.script,f)) |
| 6520 | { | ||
| 6521 | ✗ | return qe_invalid; | |
| 6522 | } | ||
| 6523 | |||
| 6524 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if(s_version<=3) |
| 6525 | { | ||
| 6526 | ✗ | if(tempitem.script > NUMSCRIPTITEM) | |
| 6527 | { | ||
| 6528 | ✗ | tempitem.script = 0; | |
| 6529 | ✗ | } | |
| 6530 | ✗ | } | |
| 6531 | |||
| 6532 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 84992 times.
|
84992 | if(!p_getc(&tempitem.count,f)) |
| 6533 | { | ||
| 6534 | ✗ | return qe_invalid; | |
| 6535 | } | ||
| 6536 | |||
| 6537 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if(!p_igetw(&tempitem.amount,f)) |
| 6538 | { | ||
| 6539 | ✗ | return qe_invalid; | |
| 6540 | } | ||
| 6541 | |||
| 6542 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 84992 times.
|
84992 | if(!p_igetw(&tempitem.collect_script,f)) |
| 6543 | { | ||
| 6544 | ✗ | return qe_invalid; | |
| 6545 | } | ||
| 6546 | |||
| 6547 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if(s_version<=3) |
| 6548 | { | ||
| 6549 | ✗ | if(tempitem.collect_script > NUMSCRIPTITEM) | |
| 6550 | { | ||
| 6551 | ✗ | tempitem.collect_script = 0; | |
| 6552 | ✗ | } | |
| 6553 | ✗ | } | |
| 6554 | |||
| 6555 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if(!p_igetw(&tempitem.setmax,f)) |
| 6556 | { | ||
| 6557 | ✗ | return qe_invalid; | |
| 6558 | } | ||
| 6559 | |||
| 6560 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if(!p_igetw(&tempitem.max,f)) |
| 6561 | { | ||
| 6562 | ✗ | return qe_invalid; | |
| 6563 | } | ||
| 6564 | |||
| 6565 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 84992 times.
|
84992 | if(!p_getc(&tempitem.playsound,f)) |
| 6566 | { | ||
| 6567 | ✗ | return qe_invalid; | |
| 6568 | } | ||
| 6569 | |||
| 6570 |
2/2✓ Branch 0 taken 679936 times.
✓ Branch 1 taken 84992 times.
|
764928 | for(int32_t j=0; j<8; j++) |
| 6571 | { | ||
| 6572 |
1/2✓ Branch 0 taken 679936 times.
✗ Branch 1 not taken.
|
679936 | if(!p_igetl(&tempitem.initiald[j],f)) |
| 6573 | { | ||
| 6574 | ✗ | return qe_invalid; | |
| 6575 | } | ||
| 6576 | 679936 | } | |
| 6577 | |||
| 6578 |
2/2✓ Branch 0 taken 169984 times.
✓ Branch 1 taken 84992 times.
|
254976 | for(int32_t j=0; j<2; j++) |
| 6579 | { | ||
| 6580 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_getc(&tempitem.initiala[j],f)) |
| 6581 | { | ||
| 6582 | ✗ | return qe_invalid; | |
| 6583 | } | ||
| 6584 | 169984 | } | |
| 6585 | |||
| 6586 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 84992 times.
|
84992 | if(s_version>4) |
| 6587 | { | ||
| 6588 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if(s_version>5) |
| 6589 | { | ||
| 6590 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if(!p_getc(&tempitem.wpn,f)) |
| 6591 | { | ||
| 6592 | ✗ | return qe_invalid; | |
| 6593 | } | ||
| 6594 | |||
| 6595 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 84992 times.
|
84992 | if(!p_getc(&tempitem.wpn2,f)) |
| 6596 | { | ||
| 6597 | ✗ | return qe_invalid; | |
| 6598 | } | ||
| 6599 | |||
| 6600 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if(!p_getc(&tempitem.wpn3,f)) |
| 6601 | { | ||
| 6602 | ✗ | return qe_invalid; | |
| 6603 | } | ||
| 6604 | |||
| 6605 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if(!p_getc(&tempitem.wpn4,f)) |
| 6606 | { | ||
| 6607 | ✗ | return qe_invalid; | |
| 6608 | } | ||
| 6609 | |||
| 6610 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 84992 times.
|
84992 | if(s_version>=15) |
| 6611 | { | ||
| 6612 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 84992 times.
|
84992 | if(!p_getc(&tempitem.wpn5,f)) |
| 6613 | { | ||
| 6614 | ✗ | return qe_invalid; | |
| 6615 | } | ||
| 6616 | |||
| 6617 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if(!p_getc(&tempitem.wpn6,f)) |
| 6618 | { | ||
| 6619 | ✗ | return qe_invalid; | |
| 6620 | } | ||
| 6621 | |||
| 6622 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if(!p_getc(&tempitem.wpn7,f)) |
| 6623 | { | ||
| 6624 | ✗ | return qe_invalid; | |
| 6625 | } | ||
| 6626 | |||
| 6627 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if(!p_getc(&tempitem.wpn8,f)) |
| 6628 | { | ||
| 6629 | ✗ | return qe_invalid; | |
| 6630 | } | ||
| 6631 | |||
| 6632 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 84992 times.
|
84992 | if(!p_getc(&tempitem.wpn9,f)) |
| 6633 | { | ||
| 6634 | ✗ | return qe_invalid; | |
| 6635 | } | ||
| 6636 | |||
| 6637 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if(!p_getc(&tempitem.wpn10,f)) |
| 6638 | { | ||
| 6639 | ✗ | return qe_invalid; | |
| 6640 | } | ||
| 6641 | 84992 | } | |
| 6642 | |||
| 6643 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if(!p_getc(&tempitem.pickup_hearts,f)) |
| 6644 | { | ||
| 6645 | ✗ | return qe_invalid; | |
| 6646 | } | ||
| 6647 | |||
| 6648 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 84992 times.
|
84992 | if(s_version<15) |
| 6649 | { | ||
| 6650 | ✗ | if(!p_igetw(&dummy_word,f)) | |
| 6651 | { | ||
| 6652 | ✗ | return qe_invalid; | |
| 6653 | } | ||
| 6654 | |||
| 6655 | ✗ | tempitem.misc1=dummy_word; | |
| 6656 | |||
| 6657 | ✗ | if(!p_igetw(&dummy_word,f)) | |
| 6658 | { | ||
| 6659 | ✗ | return qe_invalid; | |
| 6660 | } | ||
| 6661 | |||
| 6662 | ✗ | tempitem.misc2=dummy_word; | |
| 6663 | ✗ | } | |
| 6664 | else | ||
| 6665 | { | ||
| 6666 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if(!p_igetl(&tempitem.misc1,f)) |
| 6667 | { | ||
| 6668 | ✗ | return qe_invalid; | |
| 6669 | } | ||
| 6670 | |||
| 6671 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 84992 times.
|
84992 | if(!p_igetl(&tempitem.misc2,f)) |
| 6672 | { | ||
| 6673 | ✗ | return qe_invalid; | |
| 6674 | } | ||
| 6675 | |||
| 6676 | // Version 24: sh_ice -> sh_script; previously, all shields could block script weapons | ||
| 6677 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if(s_version<24) |
| 6678 | { | ||
| 6679 | ✗ | if(tempitem.family==itype_shield) | |
| 6680 | { | ||
| 6681 | ✗ | tempitem.misc1|=sh_script; | |
| 6682 | ✗ | } | |
| 6683 | ✗ | } | |
| 6684 | } | ||
| 6685 | |||
| 6686 |
2/2✓ Branch 0 taken 48384 times.
✓ Branch 1 taken 36608 times.
|
84992 | if(s_version < 53) |
| 6687 | { | ||
| 6688 | byte tempbyte; | ||
| 6689 |
1/2✓ Branch 0 taken 48384 times.
✗ Branch 1 not taken.
|
48384 | if(!p_getc(&tempbyte,f)) |
| 6690 | { | ||
| 6691 | ✗ | return qe_invalid; | |
| 6692 | } | ||
| 6693 | 48384 | tempitem.cost_amount[0] = tempbyte; | |
| 6694 | 48384 | } | |
| 6695 | else | ||
| 6696 | { | ||
| 6697 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 36608 times.
|
109824 | for(auto q = 0; q < 2; ++q) |
| 6698 | { | ||
| 6699 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 73216 times.
|
73216 | if(!p_igetw(&tempitem.cost_amount[q],f)) |
| 6700 | { | ||
| 6701 | ✗ | return qe_invalid; | |
| 6702 | } | ||
| 6703 | 73216 | } | |
| 6704 | } | ||
| 6705 | 84992 | } | |
| 6706 | else | ||
| 6707 | { | ||
| 6708 | char tempchar; | ||
| 6709 | |||
| 6710 | ✗ | if(!p_getc(&tempchar,f)) | |
| 6711 | { | ||
| 6712 | ✗ | return qe_invalid; | |
| 6713 | } | ||
| 6714 | |||
| 6715 | ✗ | if (tempchar) tempitem.flags |= item_edible; | |
| 6716 | } | ||
| 6717 | |||
| 6718 | // June 2007: more misc. attributes | ||
| 6719 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 84992 times.
|
84992 | if(s_version>=12) |
| 6720 | { | ||
| 6721 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 84992 times.
|
84992 | if(s_version<15) |
| 6722 | { | ||
| 6723 | ✗ | if(!p_igetw(&dummy_word,f)) | |
| 6724 | { | ||
| 6725 | ✗ | return qe_invalid; | |
| 6726 | } | ||
| 6727 | |||
| 6728 | ✗ | tempitem.misc3=dummy_word; | |
| 6729 | |||
| 6730 | ✗ | if(!p_igetw(&dummy_word,f)) | |
| 6731 | { | ||
| 6732 | ✗ | return qe_invalid; | |
| 6733 | } | ||
| 6734 | |||
| 6735 | ✗ | tempitem.misc4=dummy_word; | |
| 6736 | ✗ | } | |
| 6737 | else | ||
| 6738 | { | ||
| 6739 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 84992 times.
|
84992 | if(!p_igetl(&tempitem.misc3,f)) |
| 6740 | { | ||
| 6741 | ✗ | return qe_invalid; | |
| 6742 | } | ||
| 6743 | |||
| 6744 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if(!p_igetl(&tempitem.misc4,f)) |
| 6745 | { | ||
| 6746 | ✗ | return qe_invalid; | |
| 6747 | } | ||
| 6748 | |||
| 6749 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if(!p_igetl(&tempitem.misc5,f)) |
| 6750 | { | ||
| 6751 | ✗ | return qe_invalid; | |
| 6752 | } | ||
| 6753 | |||
| 6754 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if(!p_igetl(&tempitem.misc6,f)) |
| 6755 | { | ||
| 6756 | ✗ | return qe_invalid; | |
| 6757 | } | ||
| 6758 | |||
| 6759 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 84992 times.
|
84992 | if(!p_igetl(&tempitem.misc7,f)) |
| 6760 | { | ||
| 6761 | ✗ | return qe_invalid; | |
| 6762 | } | ||
| 6763 | |||
| 6764 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if(!p_igetl(&tempitem.misc8,f)) |
| 6765 | { | ||
| 6766 | ✗ | return qe_invalid; | |
| 6767 | } | ||
| 6768 | |||
| 6769 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 84992 times.
|
84992 | if(!p_igetl(&tempitem.misc9,f)) |
| 6770 | { | ||
| 6771 | ✗ | return qe_invalid; | |
| 6772 | } | ||
| 6773 | |||
| 6774 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if(!p_igetl(&tempitem.misc10,f)) |
| 6775 | { | ||
| 6776 | ✗ | return qe_invalid; | |
| 6777 | } | ||
| 6778 | } | ||
| 6779 | |||
| 6780 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 84992 times.
|
84992 | if(!p_getc(&tempitem.usesound,f)) |
| 6781 | { | ||
| 6782 | ✗ | return qe_invalid; | |
| 6783 | } | ||
| 6784 | |||
| 6785 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 48384 times.
|
84992 | if(s_version >= 49) |
| 6786 | { | ||
| 6787 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36608 times.
|
36608 | if(!p_getc(&tempitem.usesound2,f)) |
| 6788 | { | ||
| 6789 | ✗ | return qe_invalid; | |
| 6790 | } | ||
| 6791 | 36608 | } | |
| 6792 | 48384 | else tempitem.usesound2 = 0; | |
| 6793 | |||
| 6794 |
3/4✓ Branch 0 taken 48384 times.
✓ Branch 1 taken 36608 times.
✓ Branch 2 taken 48384 times.
✗ Branch 3 not taken.
|
84992 | if(s_version < 50 && tempitem.family == itype_mirror) |
| 6795 | { | ||
| 6796 | //Split continue/dmap warp effect/sfx, port for old | ||
| 6797 | ✗ | tempitem.misc2 = tempitem.misc1; | |
| 6798 | ✗ | tempitem.usesound2 = tempitem.usesound; | |
| 6799 | ✗ | } | |
| 6800 | 84992 | } | |
| 6801 | 84992 | } | |
| 6802 | |||
| 6803 |
2/2✓ Branch 0 taken 48384 times.
✓ Branch 1 taken 36608 times.
|
84992 | if ( s_version >= 26 ) //! New itemdata vars for weapon editor. -Z |
| 6804 | { // temp.useweapon, temp.usedefence, temp.weaprange, temp.weap_pattern[ITEM_MOVEMENT_PATTERNS] | ||
| 6805 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36608 times.
|
36608 | if(!p_getc(&tempitem.useweapon,f)) |
| 6806 | { | ||
| 6807 | ✗ | return qe_invalid; | |
| 6808 | } | ||
| 6809 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36608 times.
|
36608 | if(!p_getc(&tempitem.usedefence,f)) |
| 6810 | { | ||
| 6811 | ✗ | return qe_invalid; | |
| 6812 | } | ||
| 6813 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if(!p_igetl(&tempitem.weaprange,f)) |
| 6814 | { | ||
| 6815 | ✗ | return qe_invalid; | |
| 6816 | } | ||
| 6817 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if(!p_igetl(&tempitem.weapduration,f)) |
| 6818 | { | ||
| 6819 | ✗ | return qe_invalid; | |
| 6820 | } | ||
| 6821 |
2/2✓ Branch 0 taken 366080 times.
✓ Branch 1 taken 36608 times.
|
402688 | for ( int32_t q = 0; q < ITEM_MOVEMENT_PATTERNS; q++ ) |
| 6822 | { | ||
| 6823 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 366080 times.
|
366080 | if(!p_igetl(&tempitem.weap_pattern[q],f)) |
| 6824 | { | ||
| 6825 | ✗ | return qe_invalid; | |
| 6826 | } | ||
| 6827 | 366080 | } | |
| 6828 | 36608 | } | |
| 6829 | |||
| 6830 |
2/2✓ Branch 0 taken 48384 times.
✓ Branch 1 taken 36608 times.
|
84992 | if ( s_version >= 27 ) //! New itemdata vars for weapon editor. -Z |
| 6831 | { // temp.useweapon, temp.usedefence, temp.weaprange, temp.weap_pattern[ITEM_MOVEMENT_PATTERNS] | ||
| 6832 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if(!p_igetl(&tempitem.duplicates,f)) |
| 6833 | { | ||
| 6834 | ✗ | return qe_invalid; | |
| 6835 | } | ||
| 6836 |
2/2✓ Branch 0 taken 292864 times.
✓ Branch 1 taken 36608 times.
|
329472 | for ( int32_t q = 0; q < INITIAL_D; q++ ) |
| 6837 | { | ||
| 6838 |
1/2✓ Branch 0 taken 292864 times.
✗ Branch 1 not taken.
|
292864 | if(!p_igetl(&tempitem.weap_initiald[q],f)) |
| 6839 | { | ||
| 6840 | ✗ | return qe_invalid; | |
| 6841 | } | ||
| 6842 | 292864 | } | |
| 6843 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 36608 times.
|
109824 | for ( int32_t q = 0; q < INITIAL_A; q++ ) |
| 6844 | { | ||
| 6845 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_getc(&tempitem.weap_initiala[q],f)) |
| 6846 | { | ||
| 6847 | ✗ | return qe_invalid; | |
| 6848 | } | ||
| 6849 | 73216 | } | |
| 6850 | |||
| 6851 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36608 times.
|
36608 | if(!p_getc(&tempitem.drawlayer,f)) |
| 6852 | { | ||
| 6853 | ✗ | return qe_invalid; | |
| 6854 | } | ||
| 6855 | |||
| 6856 | |||
| 6857 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if(!p_igetl(&tempitem.hxofs,f)) |
| 6858 | { | ||
| 6859 | ✗ | return qe_invalid; | |
| 6860 | } | ||
| 6861 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if(!p_igetl(&tempitem.hyofs,f)) |
| 6862 | { | ||
| 6863 | ✗ | return qe_invalid; | |
| 6864 | } | ||
| 6865 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if(!p_igetl(&tempitem.hxsz,f)) |
| 6866 | { | ||
| 6867 | ✗ | return qe_invalid; | |
| 6868 | } | ||
| 6869 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if(!p_igetl(&tempitem.hysz,f)) |
| 6870 | { | ||
| 6871 | ✗ | return qe_invalid; | |
| 6872 | } | ||
| 6873 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36608 times.
|
36608 | if(!p_igetl(&tempitem.hzsz,f)) |
| 6874 | { | ||
| 6875 | ✗ | return qe_invalid; | |
| 6876 | } | ||
| 6877 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36608 times.
|
36608 | if(!p_igetl(&tempitem.xofs,f)) |
| 6878 | { | ||
| 6879 | ✗ | return qe_invalid; | |
| 6880 | } | ||
| 6881 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if(!p_igetl(&tempitem.yofs,f)) |
| 6882 | { | ||
| 6883 | ✗ | return qe_invalid; | |
| 6884 | } | ||
| 6885 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36608 times.
|
36608 | if(!p_igetl(&tempitem.weap_hxofs,f)) |
| 6886 | { | ||
| 6887 | ✗ | return qe_invalid; | |
| 6888 | } | ||
| 6889 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if(!p_igetl(&tempitem.weap_hyofs,f)) |
| 6890 | { | ||
| 6891 | ✗ | return qe_invalid; | |
| 6892 | } | ||
| 6893 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36608 times.
|
36608 | if(!p_igetl(&tempitem.weap_hxsz,f)) |
| 6894 | { | ||
| 6895 | ✗ | return qe_invalid; | |
| 6896 | } | ||
| 6897 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36608 times.
|
36608 | if(!p_igetl(&tempitem.weap_hysz,f)) |
| 6898 | { | ||
| 6899 | ✗ | return qe_invalid; | |
| 6900 | } | ||
| 6901 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36608 times.
|
36608 | if(!p_igetl(&tempitem.weap_hzsz,f)) |
| 6902 | { | ||
| 6903 | ✗ | return qe_invalid; | |
| 6904 | } | ||
| 6905 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36608 times.
|
36608 | if(!p_igetl(&tempitem.weap_xofs,f)) |
| 6906 | { | ||
| 6907 | ✗ | return qe_invalid; | |
| 6908 | } | ||
| 6909 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if(!p_igetl(&tempitem.weap_yofs,f)) |
| 6910 | { | ||
| 6911 | ✗ | return qe_invalid; | |
| 6912 | } | ||
| 6913 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36608 times.
|
36608 | if(!p_igetw(&tempitem.weaponscript,f)) |
| 6914 | { | ||
| 6915 | ✗ | return qe_invalid; | |
| 6916 | } | ||
| 6917 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if(!p_igetl(&tempitem.wpnsprite,f)) |
| 6918 | { | ||
| 6919 | ✗ | return qe_invalid; | |
| 6920 | } | ||
| 6921 | 36608 | auto num_cost_tmr = (s_version > 52 ? 2 : 1); | |
| 6922 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 36608 times.
|
109824 | for(auto q = 0; q < num_cost_tmr; ++q) |
| 6923 | { | ||
| 6924 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 73216 times.
|
73216 | if(!p_igetl(&tempitem.magiccosttimer[q],f)) |
| 6925 | { | ||
| 6926 | ✗ | return qe_invalid; | |
| 6927 | } | ||
| 6928 | 73216 | } | |
| 6929 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36608 times.
|
36608 | for(auto q = num_cost_tmr; q < 2; ++q) |
| 6930 | ✗ | tempitem.magiccosttimer[q] = 0; | |
| 6931 | 36608 | } | |
| 6932 |
2/2✓ Branch 0 taken 48384 times.
✓ Branch 1 taken 36608 times.
|
84992 | if ( s_version >= 28 ) //! New itemdata vars for weapon editor. -Z |
| 6933 | { | ||
| 6934 | //Item Size FLags, TileWidth, TileHeight | ||
| 6935 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36608 times.
|
36608 | if(!p_igetl(&tempitem.overrideFLAGS,f)) |
| 6936 | { | ||
| 6937 | ✗ | return qe_invalid; | |
| 6938 | } | ||
| 6939 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if(!p_igetl(&tempitem.tilew,f)) |
| 6940 | { | ||
| 6941 | ✗ | return qe_invalid; | |
| 6942 | } | ||
| 6943 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if(!p_igetl(&tempitem.tileh,f)) |
| 6944 | { | ||
| 6945 | ✗ | return qe_invalid; | |
| 6946 | } | ||
| 6947 | 36608 | } | |
| 6948 |
2/2✓ Branch 0 taken 48384 times.
✓ Branch 1 taken 36608 times.
|
84992 | if ( s_version >= 29 ) //! More new vars. |
| 6949 | { | ||
| 6950 | //Item Size FLags, TileWidth, TileHeight | ||
| 6951 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36608 times.
|
36608 | if(!p_igetl(&tempitem.weapoverrideFLAGS,f)) |
| 6952 | { | ||
| 6953 | ✗ | return qe_invalid; | |
| 6954 | } | ||
| 6955 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if(!p_igetl(&tempitem.weap_tilew,f)) |
| 6956 | { | ||
| 6957 | ✗ | return qe_invalid; | |
| 6958 | } | ||
| 6959 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if(!p_igetl(&tempitem.weap_tileh,f)) |
| 6960 | { | ||
| 6961 | ✗ | return qe_invalid; | |
| 6962 | } | ||
| 6963 | 36608 | } | |
| 6964 |
2/2✓ Branch 0 taken 48384 times.
✓ Branch 1 taken 36608 times.
|
84992 | if ( s_version >= 30 ) //! More new vars. |
| 6965 | { | ||
| 6966 | //Pickup Type | ||
| 6967 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if(!p_igetl(&tempitem.pickup,f)) |
| 6968 | { | ||
| 6969 | ✗ | return qe_invalid; | |
| 6970 | } | ||
| 6971 | 36608 | } | |
| 6972 |
2/2✓ Branch 0 taken 48384 times.
✓ Branch 1 taken 36608 times.
|
84992 | if ( s_version >= 32 ) //! More new vars. |
| 6973 | { | ||
| 6974 | //Pickup Type | ||
| 6975 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if(!p_igetw(&tempitem.pstring,f)) |
| 6976 | { | ||
| 6977 | ✗ | return qe_invalid; | |
| 6978 | } | ||
| 6979 | 36608 | } | |
| 6980 |
2/2✓ Branch 0 taken 48384 times.
✓ Branch 1 taken 36608 times.
|
84992 | if ( s_version >= 33 ) //! More new vars. |
| 6981 | { | ||
| 6982 | //Pickup Type | ||
| 6983 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36608 times.
|
36608 | if(!p_igetw(&tempitem.pickup_string_flags,f)) |
| 6984 | { | ||
| 6985 | ✗ | return qe_invalid; | |
| 6986 | } | ||
| 6987 | 36608 | } | |
| 6988 |
2/2✓ Branch 0 taken 48384 times.
✓ Branch 1 taken 36608 times.
|
84992 | if ( s_version >= 34 ) //! cost counter |
| 6989 | { | ||
| 6990 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36608 times.
|
36608 | if(s_version < 53) |
| 6991 | { | ||
| 6992 | ✗ | if(!p_getc(&tempitem.cost_counter[0],f)) | |
| 6993 | { | ||
| 6994 | ✗ | return qe_invalid; | |
| 6995 | } | ||
| 6996 | ✗ | } | |
| 6997 | else | ||
| 6998 | { | ||
| 6999 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 36608 times.
|
109824 | for(auto q = 0; q < 2; ++q) |
| 7000 | { | ||
| 7001 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_getc(&tempitem.cost_counter[q],f)) |
| 7002 | { | ||
| 7003 | ✗ | return qe_invalid; | |
| 7004 | } | ||
| 7005 | 73216 | } | |
| 7006 | } | ||
| 7007 | 36608 | } | |
| 7008 |
2/2✓ Branch 0 taken 48384 times.
✓ Branch 1 taken 36608 times.
|
84992 | if ( s_version >= 44 ) //! sprite scripts |
| 7009 | { | ||
| 7010 |
2/2✓ Branch 0 taken 292864 times.
✓ Branch 1 taken 36608 times.
|
329472 | for ( int32_t q = 0; q < 8; q++ ) |
| 7011 | { | ||
| 7012 |
2/2✓ Branch 0 taken 19036160 times.
✓ Branch 1 taken 292864 times.
|
19329024 | for ( int32_t w = 0; w < 65; w++ ) |
| 7013 | { | ||
| 7014 |
1/2✓ Branch 0 taken 19036160 times.
✗ Branch 1 not taken.
|
19036160 | if(!p_getc(&(tempitem.initD_label[q][w]),f)) |
| 7015 | { | ||
| 7016 | ✗ | return qe_invalid; | |
| 7017 | } | ||
| 7018 | 19036160 | } | |
| 7019 |
2/2✓ Branch 0 taken 19036160 times.
✓ Branch 1 taken 292864 times.
|
19329024 | for ( int32_t w = 0; w < 65; w++ ) |
| 7020 | { | ||
| 7021 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19036160 times.
|
19036160 | if(!p_getc(&(tempitem.weapon_initD_label[q][w]),f)) |
| 7022 | { | ||
| 7023 | ✗ | return qe_invalid; | |
| 7024 | } | ||
| 7025 | 19036160 | } | |
| 7026 |
2/2✓ Branch 0 taken 19036160 times.
✓ Branch 1 taken 292864 times.
|
19329024 | for ( int32_t w = 0; w < 65; w++ ) |
| 7027 | { | ||
| 7028 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19036160 times.
|
19036160 | if(!p_getc(&(tempitem.sprite_initD_label[q][w]),f)) |
| 7029 | { | ||
| 7030 | ✗ | return qe_invalid; | |
| 7031 | } | ||
| 7032 | 19036160 | } | |
| 7033 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 292864 times.
|
292864 | if(!p_igetl(&(tempitem.sprite_initiald[q]),f)) |
| 7034 | { | ||
| 7035 | ✗ | return qe_invalid; | |
| 7036 | } | ||
| 7037 | |||
| 7038 | 292864 | } | |
| 7039 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 36608 times.
|
109824 | for ( int32_t q = 0; q < 2; q++ ) |
| 7040 | { | ||
| 7041 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 73216 times.
|
73216 | if(!p_getc(&(tempitem.sprite_initiala[q]),f)) |
| 7042 | { | ||
| 7043 | ✗ | return qe_invalid; | |
| 7044 | } | ||
| 7045 | 73216 | } | |
| 7046 | //Pickup Type | ||
| 7047 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if(!p_igetw(&tempitem.sprite_script,f)) |
| 7048 | { | ||
| 7049 | ✗ | return qe_invalid; | |
| 7050 | } | ||
| 7051 | 36608 | } | |
| 7052 |
2/2✓ Branch 0 taken 48384 times.
✓ Branch 1 taken 36608 times.
|
84992 | if ( s_version >= 48 ) //! pickup flags |
| 7053 | { | ||
| 7054 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if(!p_getc(&(tempitem.pickupflag),f)) |
| 7055 | { | ||
| 7056 | ✗ | return qe_invalid; | |
| 7057 | } | ||
| 7058 | 36608 | } | |
| 7059 |
2/2✓ Branch 0 taken 51712 times.
✓ Branch 1 taken 33280 times.
|
84992 | if ( s_version >= 57 ) |
| 7060 | { | ||
| 7061 | 33280 | std::string str; | |
| 7062 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 33280 times.
✓ Branch 2 taken 33280 times.
✗ Branch 3 not taken.
|
33280 | if(!p_getcstr(&str,f)) |
| 7063 | ✗ | return qe_invalid; | |
| 7064 | 33280 | strncpy(tempitem.display_name,str.c_str(),255); | |
| 7065 |
1/3✓ Branch 0 taken 33280 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
|
33280 | } |
| 7066 | 84992 | } | |
| 7067 | else | ||
| 7068 | { | ||
| 7069 | 4130 | tempitem.count=-1; | |
| 7070 | 4130 | tempitem.family=itype_misc; | |
| 7071 | 4130 | tempitem.flags=item_none; | |
| 7072 | 4130 | tempitem.wpn=tempitem.wpn2=tempitem.wpn3=tempitem.wpn3=tempitem.pickup_hearts=tempitem.misc1=tempitem.misc2=tempitem.usesound=0; | |
| 7073 | 4130 | tempitem.playsound=WAV_SCALE; | |
| 7074 | 4130 | reset_itembuf(&tempitem,i); | |
| 7075 | } | ||
| 7076 | |||
| 7077 |
2/2✓ Branch 0 taken 56866 times.
✓ Branch 1 taken 32256 times.
|
89122 | if(s_version >= 58) |
| 7078 | { | ||
| 7079 |
2/2✓ Branch 0 taken 161280 times.
✓ Branch 1 taken 32256 times.
|
193536 | for(int q = 0; q < WPNSPR_MAX; ++q) |
| 7080 | { | ||
| 7081 |
1/2✓ Branch 0 taken 161280 times.
✗ Branch 1 not taken.
|
161280 | if(!p_getc(&tempitem.burnsprs[q],f)) |
| 7082 | ✗ | return qe_invalid; | |
| 7083 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 161280 times.
|
161280 | if(s_version >= 59) |
| 7084 |
1/2✓ Branch 0 taken 161280 times.
✗ Branch 1 not taken.
|
161280 | if(!p_getc(&tempitem.light_rads[q],f)) |
| 7085 | ✗ | return qe_invalid; | |
| 7086 | 161280 | } | |
| 7087 | 32256 | } | |
| 7088 | |||
| 7089 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 89122 times.
|
89122 | if (!should_skip) |
| 7090 | { | ||
| 7091 |
1/2✓ Branch 0 taken 89122 times.
✗ Branch 1 not taken.
|
89122 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 7092 | { | ||
| 7093 | ✗ | tempitem.script = 0; | |
| 7094 | ✗ | tempitem.weaponscript = 0; | |
| 7095 | ✗ | for(int q = 0; q < 8; ++q) | |
| 7096 | { | ||
| 7097 | ✗ | tempitem.initiald[q] = 0; | |
| 7098 | ✗ | tempitem.weap_initiald[q] = 0; | |
| 7099 | ✗ | } | |
| 7100 | ✗ | } | |
| 7101 | 89122 | memcpy(&itemsbuf[i], &tempitem, sizeof(itemdata)); | |
| 7102 | 89122 | } | |
| 7103 | 89122 | } | |
| 7104 | |||
| 7105 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 414 times.
|
415 | if (should_skip) |
| 7106 | 1 | return 0; | |
| 7107 | |||
| 7108 | ////////////////////////////////////////////////////// | ||
| 7109 | // Now do any updates because of new item additions | ||
| 7110 | // (These can't be done above because items_to_read | ||
| 7111 | // might be too low.) | ||
| 7112 | ////////////////////////////////////////////////////// | ||
| 7113 |
2/2✓ Branch 0 taken 105984 times.
✓ Branch 1 taken 414 times.
|
106398 | for(int32_t i=0; i<MAXITEMS; i++) |
| 7114 | { | ||
| 7115 | 105984 | memcpy(&tempitem, &itemsbuf[i], sizeof(itemdata)); | |
| 7116 | |||
| 7117 | //Account for older quests that didn't have an actual item for the used letter | ||
| 7118 |
4/4✓ Branch 0 taken 20992 times.
✓ Branch 1 taken 84992 times.
✓ Branch 2 taken 20910 times.
✓ Branch 3 taken 82 times.
|
105984 | if(s_version < 2 && i==iLetterUsed) |
| 7119 | { | ||
| 7120 | 82 | reset_itembuf(&tempitem, iLetterUsed); | |
| 7121 | 82 | strcpy(item_string[i],old_item_string[i]); | |
| 7122 | 82 | tempitem.tile = itemsbuf[iLetter].tile; | |
| 7123 | 82 | tempitem.csets = itemsbuf[iLetter].csets; | |
| 7124 | 82 | tempitem.misc_flags = itemsbuf[iLetter].misc_flags; | |
| 7125 | 82 | tempitem.frames = itemsbuf[iLetter].frames; | |
| 7126 | 82 | tempitem.speed = itemsbuf[iLetter].speed; | |
| 7127 | 82 | tempitem.ltm = itemsbuf[iLetter].ltm; | |
| 7128 | 82 | } | |
| 7129 | |||
| 7130 |
2/2✓ Branch 0 taken 84992 times.
✓ Branch 1 taken 20992 times.
|
105984 | if(s_version < 3) |
| 7131 | { | ||
| 7132 |
3/3✓ Branch 0 taken 1804 times.
✓ Branch 1 taken 19106 times.
✓ Branch 2 taken 82 times.
|
20992 | switch(i) |
| 7133 | { | ||
| 7134 | case iRocsFeather: | ||
| 7135 | case iHoverBoots: | ||
| 7136 | case iSpinScroll: | ||
| 7137 | case iL2SpinScroll: | ||
| 7138 | case iCrossScroll: | ||
| 7139 | case iQuakeScroll: | ||
| 7140 | case iL2QuakeScroll: | ||
| 7141 | case iWhispRing: | ||
| 7142 | case iL2WhispRing: | ||
| 7143 | case iChargeRing: | ||
| 7144 | case iL2ChargeRing: | ||
| 7145 | case iPerilScroll: | ||
| 7146 | case iWalletL3: | ||
| 7147 | case iQuiverL4: | ||
| 7148 | case iBombBagL4: | ||
| 7149 | case iBracelet: | ||
| 7150 | case iL2Bracelet: | ||
| 7151 | case iOldGlove: | ||
| 7152 | case iL2Ladder: | ||
| 7153 | case iWealthMedal: | ||
| 7154 | case iL2WealthMedal: | ||
| 7155 | case iL3WealthMedal: | ||
| 7156 | 1804 | reset_itembuf(&tempitem, i); | |
| 7157 | 1804 | strcpy(item_string[i],old_item_string[i]); | |
| 7158 | 1804 | break; | |
| 7159 | |||
| 7160 | case iSShield: | ||
| 7161 | 82 | reset_itembuf(&tempitem, i); | |
| 7162 | 82 | strcpy(item_string[i],old_item_string[i]); | |
| 7163 | 82 | strcpy(item_string[iShield],old_item_string[iShield]); | |
| 7164 | 82 | strcpy(item_string[iMShield],old_item_string[iMShield]); | |
| 7165 | 82 | break; | |
| 7166 | } | ||
| 7167 | 20992 | } | |
| 7168 | |||
| 7169 |
2/2✓ Branch 0 taken 84992 times.
✓ Branch 1 taken 20992 times.
|
105984 | if(s_version < 5) |
| 7170 | { | ||
| 7171 |
2/2✓ Branch 0 taken 574 times.
✓ Branch 1 taken 20418 times.
|
20992 | switch(i) |
| 7172 | { | ||
| 7173 | case iHeartRing: | ||
| 7174 | case iL2HeartRing: | ||
| 7175 | case iL3HeartRing: | ||
| 7176 | case iMagicRing: | ||
| 7177 | case iL2MagicRing: | ||
| 7178 | case iL3MagicRing: | ||
| 7179 | case iL4MagicRing: | ||
| 7180 | 574 | reset_itembuf(&tempitem, i); | |
| 7181 | 574 | strcpy(item_string[i],old_item_string[i]); | |
| 7182 | 574 | break; | |
| 7183 | } | ||
| 7184 | 20992 | } | |
| 7185 | |||
| 7186 |
2/2✓ Branch 0 taken 84992 times.
✓ Branch 1 taken 20992 times.
|
105984 | if(s_version < 6) // April 2007: Advanced item editing capabilities. |
| 7187 | { | ||
| 7188 |
4/4✓ Branch 0 taken 20910 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 82 times.
✓ Branch 3 taken 20828 times.
|
20992 | if(i!=iBPotion && i!=iRPotion) |
| 7189 |
2/2✓ Branch 0 taken 19304 times.
✓ Branch 1 taken 1524 times.
|
20828 | if (get_bit(deprecated_rules,32)) tempitem.flags |= item_keep_old; |
| 7190 | |||
| 7191 |
43/43✓ Branch 0 taken 82 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 82 times.
✓ Branch 3 taken 82 times.
✓ Branch 4 taken 82 times.
✓ Branch 5 taken 82 times.
✓ Branch 6 taken 82 times.
✓ Branch 7 taken 328 times.
✓ Branch 8 taken 17302 times.
✓ Branch 9 taken 82 times.
✓ Branch 10 taken 82 times.
✓ Branch 11 taken 82 times.
✓ Branch 12 taken 82 times.
✓ Branch 13 taken 82 times.
✓ Branch 14 taken 82 times.
✓ Branch 15 taken 82 times.
✓ Branch 16 taken 82 times.
✓ Branch 17 taken 82 times.
✓ Branch 18 taken 82 times.
✓ Branch 19 taken 82 times.
✓ Branch 20 taken 82 times.
✓ Branch 21 taken 82 times.
✓ Branch 22 taken 82 times.
✓ Branch 23 taken 82 times.
✓ Branch 24 taken 82 times.
✓ Branch 25 taken 82 times.
✓ Branch 26 taken 82 times.
✓ Branch 27 taken 82 times.
✓ Branch 28 taken 82 times.
✓ Branch 29 taken 82 times.
✓ Branch 30 taken 82 times.
✓ Branch 31 taken 82 times.
✓ Branch 32 taken 82 times.
✓ Branch 33 taken 82 times.
✓ Branch 34 taken 82 times.
✓ Branch 35 taken 82 times.
✓ Branch 36 taken 82 times.
✓ Branch 37 taken 82 times.
✓ Branch 38 taken 82 times.
✓ Branch 39 taken 82 times.
✓ Branch 40 taken 82 times.
✓ Branch 41 taken 82 times.
✓ Branch 42 taken 82 times.
|
20992 | switch(i) |
| 7192 | { | ||
| 7193 | case iTriforce: | ||
| 7194 | 82 | tempitem.fam_type=1; | |
| 7195 | 82 | break; | |
| 7196 | |||
| 7197 | case iBigTri: | ||
| 7198 | 82 | tempitem.fam_type=0; | |
| 7199 | 82 | break; | |
| 7200 | |||
| 7201 | case iBombs: | ||
| 7202 | 82 | tempitem.fam_type=i_bomb; | |
| 7203 | 82 | tempitem.power=4; | |
| 7204 | 82 | tempitem.wpn=wBOMB; | |
| 7205 | 82 | tempitem.wpn2=wBOOM; | |
| 7206 | 82 | tempitem.misc1 = 50; | |
| 7207 | |||
| 7208 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 82 times.
|
82 | if(get_bit(deprecated_rules,qr_SLOWBOMBFUSES_DEP)) tempitem.misc1 = 200; |
| 7209 | |||
| 7210 | 82 | break; | |
| 7211 | |||
| 7212 | case iSBomb: | ||
| 7213 | 82 | tempitem.fam_type=i_sbomb; | |
| 7214 | 82 | tempitem.power=16; | |
| 7215 | 82 | tempitem.wpn=wSBOMB; | |
| 7216 | 82 | tempitem.wpn2=wSBOOM; | |
| 7217 | 82 | tempitem.misc1 = 50; | |
| 7218 | |||
| 7219 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 82 times.
|
82 | if(get_bit(deprecated_rules,qr_SLOWBOMBFUSES_DEP)) tempitem.misc1 = 400; |
| 7220 | |||
| 7221 | 82 | break; | |
| 7222 | |||
| 7223 | case iBook: | ||
| 7224 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 82 times.
|
82 | if(get_bit(deprecated_rules, qr_FIREMAGICSPRITE_DEP)) |
| 7225 | ✗ | tempitem.wpn = wFIREMAGIC; | |
| 7226 | |||
| 7227 | 82 | break; | |
| 7228 | |||
| 7229 | case iSArrow: | ||
| 7230 | 82 | tempitem.wpn2 = get_bit(deprecated_rules,27) ? wSSPARKLE : 0; //qr_SASPARKLES | |
| 7231 | 82 | tempitem.power=4; | |
| 7232 | 82 | tempitem.flags|=item_gamedata; | |
| 7233 | 82 | tempitem.wpn=wSARROW; | |
| 7234 | 82 | break; | |
| 7235 | |||
| 7236 | case iGArrow: | ||
| 7237 | 82 | tempitem.wpn2 = get_bit(deprecated_rules,28) ? wGSPARKLE : 0; //qr_GASPARKLES | |
| 7238 | 82 | tempitem.power=8; | |
| 7239 | 82 | tempitem.flags|=(item_gamedata|item_flag1); | |
| 7240 | 82 | tempitem.wpn=wGARROW; | |
| 7241 | 82 | break; | |
| 7242 | |||
| 7243 | case iBrang: | ||
| 7244 | 82 | tempitem.power=0; | |
| 7245 | 82 | tempitem.wpn=wBRANG; | |
| 7246 | 82 | tempitem.misc1=36; | |
| 7247 | 82 | break; | |
| 7248 | |||
| 7249 | case iMBrang: | ||
| 7250 | 82 | tempitem.wpn2 = get_bit(deprecated_rules,29) ? wMSPARKLE : 0; //qr_MBSPARKLES | |
| 7251 | 82 | tempitem.power=0; | |
| 7252 | 82 | tempitem.wpn=wMBRANG; | |
| 7253 | 82 | break; | |
| 7254 | |||
| 7255 | case iFBrang: | ||
| 7256 | 82 | tempitem.wpn3 = get_bit(deprecated_rules,30) ? wFSPARKLE : 0; //qr_FBSPARKLES | |
| 7257 | 82 | tempitem.power=2; | |
| 7258 | 82 | tempitem.wpn=wFBRANG; | |
| 7259 | 82 | break; | |
| 7260 | |||
| 7261 | case iBoots: | ||
| 7262 | 82 | tempitem.cost_amount[0] = get_bit(deprecated_rules,qr_MAGICBOOTS_DEP) ? 1 : 0; | |
| 7263 | 82 | tempitem.power=7; | |
| 7264 | 82 | break; | |
| 7265 | |||
| 7266 | case iWand: | ||
| 7267 | 82 | tempitem.cost_amount[0] = get_bit(deprecated_rules,qr_MAGICWAND_DEP) ? 8 : 0; | |
| 7268 | 82 | tempitem.power=2; | |
| 7269 | 82 | tempitem.wpn=wWAND; | |
| 7270 | 82 | tempitem.wpn3=wMAGIC; | |
| 7271 | 82 | break; | |
| 7272 | |||
| 7273 | case iBCandle: | ||
| 7274 | 82 | tempitem.cost_amount[0] = get_bit(deprecated_rules,qr_MAGICCANDLE_DEP) ? 4 : 0; | |
| 7275 | 82 | tempitem.power=1; | |
| 7276 | 82 | tempitem.flags|=(item_gamedata|item_flag1); | |
| 7277 | 82 | tempitem.wpn3=wFIRE; | |
| 7278 | 82 | break; | |
| 7279 | |||
| 7280 | case iRCandle: | ||
| 7281 | 82 | tempitem.cost_amount[0] = get_bit(deprecated_rules,qr_MAGICCANDLE_DEP) ? 4 : 0; | |
| 7282 | 82 | tempitem.power=1; | |
| 7283 | 82 | tempitem.wpn3=wFIRE; | |
| 7284 | 82 | break; | |
| 7285 | |||
| 7286 | case iSword: | ||
| 7287 | 82 | tempitem.power=1; | |
| 7288 | 82 | tempitem.flags|= item_flag4 |item_flag2; | |
| 7289 | 82 | tempitem.wpn=tempitem.wpn3=wSWORD; | |
| 7290 | 82 | tempitem.wpn2=wSWORDSLASH; | |
| 7291 | 82 | break; | |
| 7292 | |||
| 7293 | case iWSword: | ||
| 7294 | 82 | tempitem.power=2; | |
| 7295 | 82 | tempitem.flags|= item_flag4 |item_flag2; | |
| 7296 | 82 | tempitem.wpn=tempitem.wpn3=wWSWORD; | |
| 7297 | 82 | tempitem.wpn2=wWSWORDSLASH; | |
| 7298 | 82 | break; | |
| 7299 | |||
| 7300 | case iMSword: | ||
| 7301 | 82 | tempitem.power=4; | |
| 7302 | 82 | tempitem.flags|= item_flag4 |item_flag2; | |
| 7303 | 82 | tempitem.wpn=tempitem.wpn3=wMSWORD; | |
| 7304 | 82 | tempitem.wpn2=wMSWORDSLASH; | |
| 7305 | 82 | break; | |
| 7306 | |||
| 7307 | case iXSword: | ||
| 7308 | 82 | tempitem.power=8; | |
| 7309 | 82 | tempitem.flags|= item_flag4 |item_flag2; | |
| 7310 | 82 | tempitem.wpn=tempitem.wpn3=wXSWORD; | |
| 7311 | 82 | tempitem.wpn2=wXSWORDSLASH; | |
| 7312 | 82 | break; | |
| 7313 | |||
| 7314 | case iDivineProtection: | ||
| 7315 | 82 | tempitem.flags |= get_bit(deprecated_rules,qr_FLICKERINGDIVINEPROTECTIONROCKET_DEP) ? item_flag1 : item_none; | |
| 7316 | 82 | tempitem.flags |= get_bit(deprecated_rules,qr_TRANSLUCENTDIVINEPROTECTIONROCKET_DEP) ? item_flag2 : item_none; | |
| 7317 | 82 | tempitem.wpn=wDIVINEPROTECTION1A; | |
| 7318 | 82 | tempitem.wpn2=wDIVINEPROTECTION1B; | |
| 7319 | 82 | tempitem.wpn3=wDIVINEPROTECTIONS1A; | |
| 7320 | 82 | tempitem.wpn4=wDIVINEPROTECTIONS1B; | |
| 7321 | 82 | tempitem.wpn6=wDIVINEPROTECTION2A; | |
| 7322 | 82 | tempitem.wpn7=wDIVINEPROTECTION2B; | |
| 7323 | 82 | tempitem.wpn8=wDIVINEPROTECTIONS2A; | |
| 7324 | 82 | tempitem.wpn9=wDIVINEPROTECTIONS2B; | |
| 7325 | 82 | tempitem.wpn5 = iwDivineProtectionShieldFront; | |
| 7326 | 82 | tempitem.wpn10 = iwDivineProtectionShieldBack; | |
| 7327 | 82 | tempitem.misc1=512; | |
| 7328 | 82 | tempitem.cost_amount[0]=64; | |
| 7329 | 82 | break; | |
| 7330 | |||
| 7331 | case iLens: | ||
| 7332 | 82 | tempitem.misc1=60; | |
| 7333 | 82 | tempitem.flags |= get_qr(qr_ENABLEMAGIC) ? item_none : item_rupee_magic; | |
| 7334 | 82 | tempitem.cost_amount[0] = get_qr(qr_ENABLEMAGIC) ? 2 : 1; | |
| 7335 | 82 | break; | |
| 7336 | |||
| 7337 | case iArrow: | ||
| 7338 | 82 | tempitem.power=2; | |
| 7339 | 82 | tempitem.wpn=wARROW; | |
| 7340 | 82 | break; | |
| 7341 | |||
| 7342 | case iHoverBoots: | ||
| 7343 | 82 | tempitem.misc1=45; | |
| 7344 | 82 | tempitem.wpn=iwHover; | |
| 7345 | 82 | break; | |
| 7346 | |||
| 7347 | case iDivineFire: | ||
| 7348 | 82 | tempitem.power=8; | |
| 7349 | 82 | tempitem.wpn=wDIVINEFIRE1A; | |
| 7350 | 82 | tempitem.wpn2=wDIVINEFIRE1B; | |
| 7351 | 82 | tempitem.wpn3=wDIVINEFIRES1A; | |
| 7352 | 82 | tempitem.wpn4=wDIVINEFIRES1B; | |
| 7353 | 82 | tempitem.misc1 = 32; | |
| 7354 | 82 | tempitem.misc2 = 200; | |
| 7355 | 82 | tempitem.cost_amount[0]=32; | |
| 7356 | 82 | break; | |
| 7357 | |||
| 7358 | case iDivineEscape: | ||
| 7359 | 82 | tempitem.cost_amount[0]=32; | |
| 7360 | 82 | break; | |
| 7361 | |||
| 7362 | case iHookshot: | ||
| 7363 | 82 | tempitem.power=0; | |
| 7364 | 82 | tempitem.flags&=~item_flag1; | |
| 7365 | 82 | tempitem.wpn=wHSHEAD; | |
| 7366 | 82 | tempitem.wpn2=wHSCHAIN_H; | |
| 7367 | 82 | tempitem.wpn4=wHSHANDLE; | |
| 7368 | 82 | tempitem.wpn3=wHSCHAIN_V; | |
| 7369 | 82 | tempitem.misc1=50; | |
| 7370 | 82 | tempitem.misc2=100; | |
| 7371 | 82 | break; | |
| 7372 | |||
| 7373 | case iLongshot: | ||
| 7374 | 82 | tempitem.power=0; | |
| 7375 | 82 | tempitem.flags&=~item_flag1; | |
| 7376 | 82 | tempitem.wpn=wLSHEAD; | |
| 7377 | 82 | tempitem.wpn2=wLSCHAIN_H; | |
| 7378 | 82 | tempitem.wpn4=wLSHANDLE; | |
| 7379 | 82 | tempitem.wpn3=wLSCHAIN_V; | |
| 7380 | 82 | tempitem.misc1=99; | |
| 7381 | 82 | tempitem.misc2=100; | |
| 7382 | 82 | break; | |
| 7383 | |||
| 7384 | case iHammer: | ||
| 7385 | 82 | tempitem.power=4; | |
| 7386 | 82 | tempitem.wpn=wHAMMER; | |
| 7387 | 82 | tempitem.wpn2=iwHammerSmack; | |
| 7388 | 82 | break; | |
| 7389 | |||
| 7390 | case iCByrna: | ||
| 7391 | 82 | tempitem.power=1; | |
| 7392 | 82 | tempitem.wpn=wCBYRNA; | |
| 7393 | 82 | tempitem.wpn2=wCBYRNASLASH; | |
| 7394 | 82 | tempitem.wpn3=wCBYRNAORB; | |
| 7395 | 82 | tempitem.misc1=4; | |
| 7396 | 82 | tempitem.misc2=16; | |
| 7397 | 82 | tempitem.misc3=1; | |
| 7398 | 82 | tempitem.cost_amount[0]=1; | |
| 7399 | 82 | break; | |
| 7400 | |||
| 7401 | case iWhistle: | ||
| 7402 | 82 | tempitem.wpn=wWIND; | |
| 7403 | 82 | tempitem.misc1=3; | |
| 7404 | 82 | tempitem.flags|=item_flag1; | |
| 7405 | 82 | break; | |
| 7406 | |||
| 7407 | case iBRing: | ||
| 7408 | 82 | tempitem.power=2; | |
| 7409 | 82 | tempitem.misc1=spBLUE; | |
| 7410 | 82 | break; | |
| 7411 | |||
| 7412 | case iRRing: | ||
| 7413 | 82 | tempitem.power=4; | |
| 7414 | 82 | tempitem.misc1=spRED; | |
| 7415 | 82 | break; | |
| 7416 | |||
| 7417 | case iGRing: | ||
| 7418 | 82 | tempitem.power=8; | |
| 7419 | 82 | tempitem.misc1=spGOLD; | |
| 7420 | 82 | break; | |
| 7421 | |||
| 7422 | case iSpinScroll: | ||
| 7423 | 82 | tempitem.power = 2; | |
| 7424 | 82 | tempitem.misc1 = 1; | |
| 7425 | 82 | break; | |
| 7426 | |||
| 7427 | case iL2SpinScroll: | ||
| 7428 | 82 | tempitem.family=itype_spinscroll2; | |
| 7429 | 82 | tempitem.fam_type=1; | |
| 7430 | 82 | tempitem.cost_amount[0]=8; | |
| 7431 | 82 | tempitem.power=2; | |
| 7432 | 82 | tempitem.misc1 = 20; | |
| 7433 | 82 | break; | |
| 7434 | |||
| 7435 | case iQuakeScroll: | ||
| 7436 | 82 | tempitem.misc1=0x10; | |
| 7437 | 82 | tempitem.misc2=64; | |
| 7438 | 82 | break; | |
| 7439 | |||
| 7440 | case iL2QuakeScroll: | ||
| 7441 | 82 | tempitem.family=itype_quakescroll2; | |
| 7442 | 82 | tempitem.fam_type=1; | |
| 7443 | 82 | tempitem.power = 2; | |
| 7444 | 82 | tempitem.misc1=0x20; | |
| 7445 | 82 | tempitem.misc2=192; | |
| 7446 | 82 | tempitem.cost_amount[0]=8; | |
| 7447 | 82 | break; | |
| 7448 | |||
| 7449 | case iChargeRing: | ||
| 7450 | 82 | tempitem.misc1=64; | |
| 7451 | 82 | tempitem.misc2=128; | |
| 7452 | 82 | break; | |
| 7453 | |||
| 7454 | case iL2ChargeRing: | ||
| 7455 | 82 | tempitem.misc1=32; | |
| 7456 | 82 | tempitem.misc2=64; | |
| 7457 | 82 | break; | |
| 7458 | |||
| 7459 | case iOldGlove: | ||
| 7460 | 82 | tempitem.flags |= item_flag1; | |
| 7461 | |||
| 7462 | //fallthrough | ||
| 7463 | case iBombBagL4: | ||
| 7464 | case iWalletL3: | ||
| 7465 | case iQuiverL4: | ||
| 7466 | case iBracelet: | ||
| 7467 | 410 | tempitem.power = 1; | |
| 7468 | 410 | break; | |
| 7469 | |||
| 7470 | case iL2Bracelet: | ||
| 7471 | 82 | tempitem.power = 2; | |
| 7472 | 82 | break; | |
| 7473 | |||
| 7474 | case iMKey: | ||
| 7475 | 82 | tempitem.power=0xFF; | |
| 7476 | 82 | tempitem.flags |= item_flag1; | |
| 7477 | 82 | break; | |
| 7478 | } | ||
| 7479 | 20992 | } | |
| 7480 | |||
| 7481 |
2/2✓ Branch 0 taken 84992 times.
✓ Branch 1 taken 20992 times.
|
105984 | if(s_version < 7) |
| 7482 | { | ||
| 7483 |
2/2✓ Branch 0 taken 328 times.
✓ Branch 1 taken 20664 times.
|
20992 | switch(i) |
| 7484 | { | ||
| 7485 | case iStoneAgony: | ||
| 7486 | case iStompBoots: | ||
| 7487 | case iPerilRing: | ||
| 7488 | case iWhimsicalRing: | ||
| 7489 | { | ||
| 7490 | 328 | reset_itembuf(&tempitem, i); | |
| 7491 | 328 | strcpy(item_string[i],old_item_string[i]); | |
| 7492 | 328 | break; | |
| 7493 | } | ||
| 7494 | } | ||
| 7495 | 20992 | } | |
| 7496 | |||
| 7497 |
2/2✓ Branch 0 taken 84992 times.
✓ Branch 1 taken 20992 times.
|
105984 | if(s_version < 8) // May 2007: Some corrections. |
| 7498 | { | ||
| 7499 |
7/7✓ Branch 0 taken 82 times.
✓ Branch 1 taken 246 times.
✓ Branch 2 taken 20336 times.
✓ Branch 3 taken 82 times.
✓ Branch 4 taken 82 times.
✓ Branch 5 taken 82 times.
✓ Branch 6 taken 82 times.
|
20992 | switch(i) |
| 7500 | { | ||
| 7501 | case iMShield: | ||
| 7502 | 82 | tempitem.misc1|=sh_flame; | |
| 7503 | 82 | tempitem.misc2|=sh_fireball|sh_magic; | |
| 7504 | |||
| 7505 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | if(get_qr(qr_SWORDMIRROR)) |
| 7506 | { | ||
| 7507 | ✗ | tempitem.misc2 |= sh_sword; | |
| 7508 | ✗ | } | |
| 7509 | |||
| 7510 | // fallthrough | ||
| 7511 | case iShield: | ||
| 7512 | 164 | tempitem.misc1|=sh_fireball|sh_sword|sh_magic; | |
| 7513 | |||
| 7514 | // fallthrough | ||
| 7515 | case iSShield: | ||
| 7516 | 246 | tempitem.misc1|=sh_rock|sh_arrow|sh_brang|sh_script; | |
| 7517 | |||
| 7518 |
1/2✓ Branch 0 taken 246 times.
✗ Branch 1 not taken.
|
246 | if(get_bit(deprecated_rules,102)) //qr_REFLECTROCKS |
| 7519 | { | ||
| 7520 | ✗ | tempitem.misc2 |= sh_rock; | |
| 7521 | ✗ | } | |
| 7522 | |||
| 7523 | 246 | break; | |
| 7524 | |||
| 7525 | case iWhispRing: | ||
| 7526 | 82 | tempitem.power=1; | |
| 7527 | 82 | tempitem.flags|=item_gamedata|item_flag1; | |
| 7528 | 82 | tempitem.misc1 = 3; | |
| 7529 | 82 | break; | |
| 7530 | |||
| 7531 | case iL2WhispRing: | ||
| 7532 | 82 | tempitem.power=0; | |
| 7533 | 82 | tempitem.flags|=item_gamedata|item_flag1; | |
| 7534 | 82 | tempitem.misc1 = 3; | |
| 7535 | 82 | break; | |
| 7536 | |||
| 7537 | case iL2Ladder: | ||
| 7538 | case iBow: | ||
| 7539 | case iCByrna: | ||
| 7540 | 246 | tempitem.power = 1; | |
| 7541 | 246 | break; | |
| 7542 | } | ||
| 7543 | 20992 | } | |
| 7544 | |||
| 7545 |
4/4✓ Branch 0 taken 20992 times.
✓ Branch 1 taken 84992 times.
✓ Branch 2 taken 20910 times.
✓ Branch 3 taken 82 times.
|
105984 | if(s_version < 9 && i==iClock) |
| 7546 | { | ||
| 7547 | 82 | tempitem.misc1 = get_bit(deprecated_rules, qr_TEMPCLOCKS_DEP) ? 256 : 0; | |
| 7548 | 82 | } | |
| 7549 | |||
| 7550 | //add the misc flag for bomb | ||
| 7551 |
4/4✓ Branch 0 taken 20992 times.
✓ Branch 1 taken 84992 times.
✓ Branch 2 taken 20910 times.
✓ Branch 3 taken 82 times.
|
105984 | if(s_version < 10 && tempitem.family == itype_bomb) |
| 7552 | { | ||
| 7553 | 82 | tempitem.flags = (tempitem.flags & ~item_flag1) | (get_qr(qr_LONGBOMBBOOM_DEP) ? item_flag1 : item_none); | |
| 7554 | 82 | } | |
| 7555 | |||
| 7556 |
4/4✓ Branch 0 taken 20992 times.
✓ Branch 1 taken 84992 times.
✓ Branch 2 taken 20828 times.
✓ Branch 3 taken 164 times.
|
105984 | if(s_version < 11 && tempitem.family == itype_triforcepiece) |
| 7557 | { | ||
| 7558 | 164 | tempitem.flags = (tempitem.fam_type ? item_gamedata : item_none); | |
| 7559 | 164 | tempitem.playsound = (tempitem.fam_type ? WAV_SCALE : WAV_CLEARED); | |
| 7560 | 164 | } | |
| 7561 | |||
| 7562 |
2/2✓ Branch 0 taken 84992 times.
✓ Branch 1 taken 20992 times.
|
105984 | if(s_version < 12) // June 2007: More Misc. attributes. |
| 7563 | { | ||
| 7564 |
5/5✓ Branch 0 taken 164 times.
✓ Branch 1 taken 20582 times.
✓ Branch 2 taken 82 times.
✓ Branch 3 taken 82 times.
✓ Branch 4 taken 82 times.
|
20992 | switch(i) |
| 7565 | { | ||
| 7566 | case iFBrang: | ||
| 7567 | 82 | tempitem.misc4 |= sh_fireball|sh_sword|sh_magic; | |
| 7568 | |||
| 7569 | //fallthrough | ||
| 7570 | case iMBrang: | ||
| 7571 | 164 | tempitem.misc3 |= sh_sword|sh_magic; | |
| 7572 | |||
| 7573 | //fallthrough | ||
| 7574 | case iHookshot: | ||
| 7575 | case iLongshot: | ||
| 7576 | //fallthrough | ||
| 7577 | 328 | tempitem.misc3 |= sh_fireball; | |
| 7578 | |||
| 7579 | case iBrang: | ||
| 7580 | 410 | tempitem.misc3 |= sh_brang|sh_rock|sh_arrow; | |
| 7581 | 410 | break; | |
| 7582 | } | ||
| 7583 | |||
| 7584 |
16/16✓ Branch 0 taken 82 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 82 times.
✓ Branch 3 taken 246 times.
✓ Branch 4 taken 246 times.
✓ Branch 5 taken 82 times.
✓ Branch 6 taken 82 times.
✓ Branch 7 taken 82 times.
✓ Branch 8 taken 328 times.
✓ Branch 9 taken 164 times.
✓ Branch 10 taken 9629 times.
✓ Branch 11 taken 164 times.
✓ Branch 12 taken 246 times.
✓ Branch 13 taken 9313 times.
✓ Branch 14 taken 82 times.
✓ Branch 15 taken 82 times.
|
20992 | switch(tempitem.family) |
| 7585 | { | ||
| 7586 | case itype_hoverboots: | ||
| 7587 | 82 | tempitem.usesound = WAV_ZN1HOVER; | |
| 7588 | 82 | break; | |
| 7589 | |||
| 7590 | case itype_wand: | ||
| 7591 | 82 | tempitem.usesound = WAV_WAND; | |
| 7592 | 82 | break; | |
| 7593 | |||
| 7594 | case itype_book: | ||
| 7595 | 82 | tempitem.usesound = WAV_FIRE; | |
| 7596 | 82 | break; | |
| 7597 | |||
| 7598 | case itype_arrow: | ||
| 7599 | 246 | tempitem.usesound = WAV_ARROW; | |
| 7600 | 246 | break; | |
| 7601 | |||
| 7602 | case itype_hookshot: | ||
| 7603 | 164 | tempitem.usesound = WAV_HOOKSHOT; | |
| 7604 | 164 | break; | |
| 7605 | |||
| 7606 | case itype_brang: | ||
| 7607 | 246 | tempitem.usesound = WAV_BRANG; | |
| 7608 | 246 | break; | |
| 7609 | |||
| 7610 | case itype_shield: | ||
| 7611 | 246 | tempitem.usesound = WAV_CHINK; | |
| 7612 | 246 | break; | |
| 7613 | |||
| 7614 | case itype_sword: | ||
| 7615 | 9313 | tempitem.usesound = WAV_SWORD; | |
| 7616 | 9313 | break; | |
| 7617 | |||
| 7618 | case itype_whistle: | ||
| 7619 | 82 | tempitem.usesound = WAV_WHISTLE; | |
| 7620 | 82 | break; | |
| 7621 | |||
| 7622 | case itype_hammer: | ||
| 7623 | 82 | tempitem.usesound = WAV_HAMMER; | |
| 7624 | 82 | break; | |
| 7625 | |||
| 7626 | case itype_divinefire: | ||
| 7627 | 82 | tempitem.usesound = WAV_ZN1DIVINEFIRE; | |
| 7628 | 82 | break; | |
| 7629 | |||
| 7630 | case itype_divineescape: | ||
| 7631 | 82 | tempitem.usesound = WAV_ZN1DIVINEESCAPE; | |
| 7632 | 82 | break; | |
| 7633 | |||
| 7634 | case itype_divineprotection: | ||
| 7635 | 82 | tempitem.usesound = WAV_ZN1DIVINEPROTECTION1; | |
| 7636 | 82 | break; | |
| 7637 | |||
| 7638 | case itype_bomb: | ||
| 7639 | case itype_sbomb: | ||
| 7640 | case itype_quakescroll: | ||
| 7641 | case itype_quakescroll2: | ||
| 7642 | 328 | tempitem.usesound = WAV_BOMB; | |
| 7643 | 328 | break; | |
| 7644 | |||
| 7645 | case itype_spinscroll: | ||
| 7646 | case itype_spinscroll2: | ||
| 7647 | 164 | tempitem.usesound = WAV_ZN1SPINATTACK; | |
| 7648 | 164 | break; | |
| 7649 | } | ||
| 7650 | 20992 | } | |
| 7651 | |||
| 7652 |
2/2✓ Branch 0 taken 84992 times.
✓ Branch 1 taken 20992 times.
|
105984 | if(s_version < 13) // July 2007 |
| 7653 | { | ||
| 7654 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 20910 times.
|
20992 | if(tempitem.family == itype_whistle) |
| 7655 | { | ||
| 7656 | 82 | tempitem.misc1 = (tempitem.power==2 ? 4 : 3); | |
| 7657 | 82 | tempitem.power = 1; | |
| 7658 | 82 | tempitem.flags|=item_flag1; | |
| 7659 | 82 | } | |
| 7660 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 20828 times.
|
20910 | else if(tempitem.family == itype_wand) |
| 7661 | 82 | tempitem.flags|=item_flag1; | |
| 7662 |
2/2✓ Branch 0 taken 20746 times.
✓ Branch 1 taken 82 times.
|
20828 | else if(tempitem.family == itype_book) |
| 7663 | { | ||
| 7664 | 82 | tempitem.flags|=item_flag1; | |
| 7665 | 82 | tempitem.power = 2; | |
| 7666 | 82 | } | |
| 7667 | 20992 | } | |
| 7668 | |||
| 7669 |
2/2✓ Branch 0 taken 84992 times.
✓ Branch 1 taken 20992 times.
|
105984 | if(s_version < 14) // August 2007 |
| 7670 | { | ||
| 7671 |
2/2✓ Branch 0 taken 164 times.
✓ Branch 1 taken 20828 times.
|
20992 | if(tempitem.family == itype_fairy) |
| 7672 | { | ||
| 7673 | 164 | tempitem.usesound = WAV_SCALE; | |
| 7674 | |||
| 7675 |
1/2✓ Branch 0 taken 164 times.
✗ Branch 1 not taken.
|
164 | if(tempitem.fam_type) |
| 7676 | 164 | tempitem.misc3=50; | |
| 7677 | 164 | } | |
| 7678 |
2/2✓ Branch 0 taken 20664 times.
✓ Branch 1 taken 164 times.
|
20828 | else if(tempitem.family == itype_potion) |
| 7679 | { | ||
| 7680 | 164 | tempitem.flags |= item_gain_old; | |
| 7681 | 164 | } | |
| 7682 | 20992 | } | |
| 7683 | |||
| 7684 |
2/2✓ Branch 0 taken 84992 times.
✓ Branch 1 taken 20992 times.
|
105984 | if(s_version < 17) // November 2007 |
| 7685 | { | ||
| 7686 |
3/4✓ Branch 0 taken 164 times.
✓ Branch 1 taken 20828 times.
✓ Branch 2 taken 164 times.
✗ Branch 3 not taken.
|
20992 | if(tempitem.family == itype_candle && !tempitem.wpn3) |
| 7687 | { | ||
| 7688 | ✗ | tempitem.wpn3 = wFIRE; | |
| 7689 | ✗ | } | |
| 7690 |
4/4✓ Branch 0 taken 246 times.
✓ Branch 1 taken 20746 times.
✓ Branch 2 taken 164 times.
✓ Branch 3 taken 82 times.
|
20992 | else if(tempitem.family == itype_arrow && tempitem.power>4) |
| 7691 | { | ||
| 7692 | 82 | tempitem.flags|=item_flag1; | |
| 7693 | 82 | } | |
| 7694 | 20992 | } | |
| 7695 | |||
| 7696 |
2/2✓ Branch 0 taken 84992 times.
✓ Branch 1 taken 20992 times.
|
105984 | if(s_version < 18) // New Year's Eve 2007 |
| 7697 | { | ||
| 7698 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 20910 times.
|
20992 | if(tempitem.family == itype_whistle) |
| 7699 | 82 | tempitem.misc2 = 8; // Use the Whistle warp ring | |
| 7700 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 20828 times.
|
20910 | else if(tempitem.family == itype_bait) |
| 7701 | 82 | tempitem.misc1 = 768; // Frames until it goes | |
| 7702 |
2/2✓ Branch 0 taken 20664 times.
✓ Branch 1 taken 164 times.
|
20828 | else if(tempitem.family == itype_triforcepiece) |
| 7703 | { | ||
| 7704 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 82 times.
|
164 | if(tempitem.flags & item_gamedata) |
| 7705 | { | ||
| 7706 | 82 | tempitem.misc2 = 1; // Cutscene 1 | |
| 7707 | 82 | tempitem.flags |= item_flag1; // Side Warp Out | |
| 7708 | 82 | } | |
| 7709 | 164 | } | |
| 7710 | 20992 | } | |
| 7711 | |||
| 7712 |
2/2✓ Branch 0 taken 84992 times.
✓ Branch 1 taken 20992 times.
|
105984 | if(s_version < 19) // January 2008 |
| 7713 | { | ||
| 7714 |
2/2✓ Branch 0 taken 20910 times.
✓ Branch 1 taken 82 times.
|
20992 | if(tempitem.family == itype_divineprotection) |
| 7715 | { | ||
| 7716 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 80 times.
|
82 | if (get_bit(deprecated_rules,qr_NOBOMBPALFLASH+1)) tempitem.flags |= item_flag3; |
| 7717 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 72 times.
|
82 | if (get_bit(deprecated_rules,qr_NOBOMBPALFLASH+2)) tempitem.flags |= item_flag4; |
| 7718 | 82 | } | |
| 7719 | 20992 | } | |
| 7720 | |||
| 7721 |
2/2✓ Branch 0 taken 84992 times.
✓ Branch 1 taken 20992 times.
|
105984 | if(s_version < 20) // October 2008 |
| 7722 | { | ||
| 7723 |
2/2✓ Branch 0 taken 20910 times.
✓ Branch 1 taken 82 times.
|
20992 | if(tempitem.family == itype_divineprotection) |
| 7724 | { | ||
| 7725 | 82 | tempitem.wpn6=wDIVINEPROTECTION2A; | |
| 7726 | 82 | tempitem.wpn7=wDIVINEPROTECTION2B; | |
| 7727 | 82 | tempitem.wpn8=wDIVINEPROTECTIONS2A; | |
| 7728 | 82 | tempitem.wpn9=wDIVINEPROTECTIONS2B; | |
| 7729 | 82 | tempitem.wpn5 = iwDivineProtectionShieldFront; | |
| 7730 | 82 | tempitem.wpn10 = iwDivineProtectionShieldBack; | |
| 7731 | 82 | } | |
| 7732 | 20992 | } | |
| 7733 | |||
| 7734 |
2/2✓ Branch 0 taken 84992 times.
✓ Branch 1 taken 20992 times.
|
105984 | if(s_version < 21) // November 2008 |
| 7735 | { | ||
| 7736 |
1/2✓ Branch 0 taken 20992 times.
✗ Branch 1 not taken.
|
20992 | if(tempitem.flags & 0x0100) // item_slash |
| 7737 | { | ||
| 7738 | ✗ | tempitem.flags &= ~item_unused; | |
| 7739 | |||
| 7740 | ✗ | if(tempitem.family == itype_sword || | |
| 7741 | ✗ | tempitem.family == itype_wand || | |
| 7742 | ✗ | tempitem.family == itype_candle || | |
| 7743 | ✗ | tempitem.family == itype_cbyrna) | |
| 7744 | { | ||
| 7745 | ✗ | tempitem.flags |= item_flag4; | |
| 7746 | ✗ | } | |
| 7747 | ✗ | } | |
| 7748 | 20992 | } | |
| 7749 | |||
| 7750 |
2/2✓ Branch 0 taken 84992 times.
✓ Branch 1 taken 20992 times.
|
105984 | if(s_version < 22) // September 2009 |
| 7751 | { | ||
| 7752 |
4/4✓ Branch 0 taken 20910 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 82 times.
✓ Branch 3 taken 20828 times.
|
20992 | if(tempitem.family == itype_sbomb || tempitem.family == itype_bomb) |
| 7753 | { | ||
| 7754 | 164 | tempitem.misc3 = tempitem.power/2; | |
| 7755 | 164 | } | |
| 7756 | 20992 | } | |
| 7757 | |||
| 7758 |
2/2✓ Branch 0 taken 84992 times.
✓ Branch 1 taken 20992 times.
|
105984 | if(s_version < 23) // March 2011 |
| 7759 | { | ||
| 7760 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 20910 times.
|
20992 | if(tempitem.family == itype_divinefire) |
| 7761 | 82 | tempitem.wpn5 = wFIRE; | |
| 7762 |
2/2✓ Branch 0 taken 20828 times.
✓ Branch 1 taken 82 times.
|
20910 | else if(tempitem.family == itype_book) |
| 7763 | 82 | tempitem.wpn2 = wFIRE; | |
| 7764 | 20992 | } | |
| 7765 | |||
| 7766 | // Version 25: Bomb bags were acting as though "super bombs also" was checked | ||
| 7767 | // whether it was or not, and a lot of existing quests depended on the | ||
| 7768 | // incorrect behavior. | ||
| 7769 |
2/2✓ Branch 0 taken 84992 times.
✓ Branch 1 taken 20992 times.
|
105984 | if(s_version < 25) // January 2012 |
| 7770 | { | ||
| 7771 |
2/2✓ Branch 0 taken 20664 times.
✓ Branch 1 taken 328 times.
|
20992 | if(tempitem.family == itype_bombbag) |
| 7772 | 328 | tempitem.flags |= item_flag1; | |
| 7773 | |||
| 7774 |
2/2✓ Branch 0 taken 20910 times.
✓ Branch 1 taken 82 times.
|
20992 | if(tempitem.family == itype_divinefire) |
| 7775 | 82 | tempitem.flags |= item_flag3; // Sideview gravity flag | |
| 7776 | 20992 | } | |
| 7777 | |||
| 7778 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 69376 times.
|
105984 | if( version < 0x254) //Nuke greyed-out flags/values from <=2.53, in case they are used in 2.54/2.55 |
| 7779 | { | ||
| 7780 |
60/60✓ Branch 0 taken 17515 times.
✓ Branch 1 taken 813 times.
✓ Branch 2 taken 801 times.
✓ Branch 3 taken 580 times.
✓ Branch 4 taken 317 times.
✓ Branch 5 taken 271 times.
✓ Branch 6 taken 538 times.
✓ Branch 7 taken 593 times.
✓ Branch 8 taken 287 times.
✓ Branch 9 taken 861 times.
✓ Branch 10 taken 861 times.
✓ Branch 11 taken 534 times.
✓ Branch 12 taken 821 times.
✓ Branch 13 taken 538 times.
✓ Branch 14 taken 269 times.
✓ Branch 15 taken 538 times.
✓ Branch 16 taken 285 times.
✓ Branch 17 taken 269 times.
✓ Branch 18 taken 813 times.
✓ Branch 19 taken 271 times.
✓ Branch 20 taken 273 times.
✓ Branch 21 taken 540 times.
✓ Branch 22 taken 245 times.
✓ Branch 23 taken 271 times.
✓ Branch 24 taken 269 times.
✓ Branch 25 taken 269 times.
✓ Branch 26 taken 269 times.
✓ Branch 27 taken 285 times.
✓ Branch 28 taken 271 times.
✓ Branch 29 taken 271 times.
✓ Branch 30 taken 269 times.
✓ Branch 31 taken 273 times.
✓ Branch 32 taken 538 times.
✓ Branch 33 taken 1076 times.
✓ Branch 34 taken 759 times.
✓ Branch 35 taken 269 times.
✓ Branch 36 taken 523 times.
✓ Branch 37 taken 1076 times.
✓ Branch 38 taken 269 times.
✓ Branch 39 taken 269 times.
✓ Branch 40 taken 269 times.
✓ Branch 41 taken 269 times.
✓ Branch 42 taken 269 times.
✓ Branch 43 taken 540 times.
✓ Branch 44 taken 538 times.
✓ Branch 45 taken 269 times.
✓ Branch 46 taken 809 times.
✓ Branch 47 taken 811 times.
✓ Branch 48 taken 1084 times.
✓ Branch 49 taken 269 times.
✓ Branch 50 taken 269 times.
✓ Branch 51 taken 269 times.
✓ Branch 52 taken 269 times.
✓ Branch 53 taken 269 times.
✓ Branch 54 taken 295 times.
✓ Branch 55 taken 9413 times.
✓ Branch 56 taken 2766 times.
✓ Branch 57 taken 811 times.
✓ Branch 58 taken 3150 times.
✓ Branch 59 taken 10679 times.
|
69376 | switch(tempitem.family) |
| 7781 | { | ||
| 7782 | case itype_sword: | ||
| 7783 | { | ||
| 7784 | 17515 | tempitem.flags &= ~(item_flag5); | |
| 7785 | 17515 | tempitem.misc3 = 0; | |
| 7786 | 17515 | tempitem.misc4 = 0; | |
| 7787 | 17515 | tempitem.misc5 = 0; | |
| 7788 | 17515 | tempitem.misc6 = 0; | |
| 7789 | 17515 | tempitem.misc7 = 0; | |
| 7790 | 17515 | tempitem.misc8 = 0; | |
| 7791 | 17515 | tempitem.misc9 = 0; | |
| 7792 | 17515 | tempitem.misc10 = 0; | |
| 7793 | 17515 | tempitem.wpn4 = 0; | |
| 7794 | 17515 | tempitem.wpn5 = 0; | |
| 7795 | 17515 | tempitem.wpn6 = 0; | |
| 7796 | 17515 | tempitem.wpn7 = 0; | |
| 7797 | 17515 | tempitem.wpn8 = 0; | |
| 7798 | 17515 | tempitem.wpn9 = 0; | |
| 7799 | 17515 | tempitem.wpn10 = 0; | |
| 7800 | 17515 | break; | |
| 7801 | } | ||
| 7802 | case itype_brang: | ||
| 7803 | { | ||
| 7804 | 813 | tempitem.flags &= ~(item_flag4 | item_flag5); | |
| 7805 | 813 | tempitem.misc2 = 0; | |
| 7806 | 813 | tempitem.misc5 = 0; | |
| 7807 | 813 | tempitem.misc6 = 0; | |
| 7808 | 813 | tempitem.misc7 = 0; | |
| 7809 | 813 | tempitem.misc8 = 0; | |
| 7810 | 813 | tempitem.misc9 = 0; | |
| 7811 | 813 | tempitem.misc10 = 0; | |
| 7812 | 813 | tempitem.wpn4 = 0; | |
| 7813 | 813 | tempitem.wpn5 = 0; | |
| 7814 | 813 | tempitem.wpn6 = 0; | |
| 7815 | 813 | tempitem.wpn7 = 0; | |
| 7816 | 813 | tempitem.wpn8 = 0; | |
| 7817 | 813 | tempitem.wpn9 = 0; | |
| 7818 | 813 | tempitem.wpn10 = 0; | |
| 7819 | 813 | break; | |
| 7820 | } | ||
| 7821 | case itype_arrow: | ||
| 7822 | { | ||
| 7823 | 801 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 7824 | 801 | tempitem.misc2 = 0; | |
| 7825 | 801 | tempitem.misc3 = 0; | |
| 7826 | 801 | tempitem.misc4 = 0; | |
| 7827 | 801 | tempitem.misc5 = 0; | |
| 7828 | 801 | tempitem.misc6 = 0; | |
| 7829 | 801 | tempitem.misc7 = 0; | |
| 7830 | 801 | tempitem.misc8 = 0; | |
| 7831 | 801 | tempitem.misc9 = 0; | |
| 7832 | 801 | tempitem.misc10 = 0; | |
| 7833 | 801 | tempitem.wpn4 = 0; | |
| 7834 | 801 | tempitem.wpn5 = 0; | |
| 7835 | 801 | tempitem.wpn6 = 0; | |
| 7836 | 801 | tempitem.wpn7 = 0; | |
| 7837 | 801 | tempitem.wpn8 = 0; | |
| 7838 | 801 | tempitem.wpn9 = 0; | |
| 7839 | 801 | tempitem.wpn10 = 0; | |
| 7840 | 801 | break; | |
| 7841 | } | ||
| 7842 | case itype_candle: | ||
| 7843 | { | ||
| 7844 | 580 | tempitem.flags &= ~ (item_flag3 | item_flag5); | |
| 7845 | 580 | tempitem.misc1 = 0; | |
| 7846 | 580 | tempitem.misc2 = 0; | |
| 7847 | 580 | tempitem.misc3 = 0; | |
| 7848 | 580 | tempitem.misc4 = 0; | |
| 7849 | 580 | tempitem.misc5 = 0; | |
| 7850 | 580 | tempitem.misc6 = 0; | |
| 7851 | 580 | tempitem.misc7 = 0; | |
| 7852 | 580 | tempitem.misc8 = 0; | |
| 7853 | 580 | tempitem.misc9 = 0; | |
| 7854 | 580 | tempitem.misc10 = 0; | |
| 7855 | 580 | tempitem.wpn4 = 0; | |
| 7856 | 580 | tempitem.wpn5 = 0; | |
| 7857 | 580 | tempitem.wpn6 = 0; | |
| 7858 | 580 | tempitem.wpn7 = 0; | |
| 7859 | 580 | tempitem.wpn8 = 0; | |
| 7860 | 580 | tempitem.wpn9 = 0; | |
| 7861 | 580 | tempitem.wpn10 = 0; | |
| 7862 | 580 | break; | |
| 7863 | } | ||
| 7864 | case itype_whistle: | ||
| 7865 | { | ||
| 7866 | 317 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 7867 | 317 | tempitem.misc3 = 0; | |
| 7868 | 317 | tempitem.misc4 = 0; | |
| 7869 | 317 | tempitem.misc5 = 0; | |
| 7870 | 317 | tempitem.misc6 = 0; | |
| 7871 | 317 | tempitem.misc7 = 0; | |
| 7872 | 317 | tempitem.misc8 = 0; | |
| 7873 | 317 | tempitem.misc9 = 0; | |
| 7874 | 317 | tempitem.misc10 = 0; | |
| 7875 | 317 | tempitem.wpn2 = 0; | |
| 7876 | 317 | tempitem.wpn3 = 0; | |
| 7877 | 317 | tempitem.wpn4 = 0; | |
| 7878 | 317 | tempitem.wpn5 = 0; | |
| 7879 | 317 | tempitem.wpn6 = 0; | |
| 7880 | 317 | tempitem.wpn7 = 0; | |
| 7881 | 317 | tempitem.wpn8 = 0; | |
| 7882 | 317 | tempitem.wpn9 = 0; | |
| 7883 | 317 | tempitem.wpn10 = 0; | |
| 7884 | 317 | break; | |
| 7885 | } | ||
| 7886 | case itype_bait: | ||
| 7887 | { | ||
| 7888 | 271 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 7889 | 271 | tempitem.misc2 = 0; | |
| 7890 | 271 | tempitem.misc3 = 0; | |
| 7891 | 271 | tempitem.misc4 = 0; | |
| 7892 | 271 | tempitem.misc5 = 0; | |
| 7893 | 271 | tempitem.misc6 = 0; | |
| 7894 | 271 | tempitem.misc7 = 0; | |
| 7895 | 271 | tempitem.misc8 = 0; | |
| 7896 | 271 | tempitem.misc9 = 0; | |
| 7897 | 271 | tempitem.misc10 = 0; | |
| 7898 | 271 | tempitem.wpn2 = 0; | |
| 7899 | 271 | tempitem.wpn3 = 0; | |
| 7900 | 271 | tempitem.wpn4 = 0; | |
| 7901 | 271 | tempitem.wpn5 = 0; | |
| 7902 | 271 | tempitem.wpn6 = 0; | |
| 7903 | 271 | tempitem.wpn7 = 0; | |
| 7904 | 271 | tempitem.wpn8 = 0; | |
| 7905 | 271 | tempitem.wpn9 = 0; | |
| 7906 | 271 | tempitem.wpn10 = 0; | |
| 7907 | 271 | break; | |
| 7908 | } | ||
| 7909 | case itype_letter: | ||
| 7910 | { | ||
| 7911 | 538 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 7912 | 538 | tempitem.misc1 = 0; | |
| 7913 | 538 | tempitem.misc2 = 0; | |
| 7914 | 538 | tempitem.misc3 = 0; | |
| 7915 | 538 | tempitem.misc4 = 0; | |
| 7916 | 538 | tempitem.misc5 = 0; | |
| 7917 | 538 | tempitem.misc6 = 0; | |
| 7918 | 538 | tempitem.misc7 = 0; | |
| 7919 | 538 | tempitem.misc8 = 0; | |
| 7920 | 538 | tempitem.misc9 = 0; | |
| 7921 | 538 | tempitem.misc10 = 0; | |
| 7922 | 538 | tempitem.wpn = 0; | |
| 7923 | 538 | tempitem.wpn2 = 0; | |
| 7924 | 538 | tempitem.wpn3 = 0; | |
| 7925 | 538 | tempitem.wpn4 = 0; | |
| 7926 | 538 | tempitem.wpn5 = 0; | |
| 7927 | 538 | tempitem.wpn6 = 0; | |
| 7928 | 538 | tempitem.wpn7 = 0; | |
| 7929 | 538 | tempitem.wpn8 = 0; | |
| 7930 | 538 | tempitem.wpn9 = 0; | |
| 7931 | 538 | tempitem.wpn10 = 0; | |
| 7932 | 538 | break; | |
| 7933 | } | ||
| 7934 | case itype_potion: | ||
| 7935 | { | ||
| 7936 | 593 | tempitem.flags &= ~ (item_flag3 | item_flag4 | item_flag5); | |
| 7937 | 593 | tempitem.misc3 = 0; | |
| 7938 | 593 | tempitem.misc4 = 0; | |
| 7939 | 593 | tempitem.misc5 = 0; | |
| 7940 | 593 | tempitem.misc6 = 0; | |
| 7941 | 593 | tempitem.misc7 = 0; | |
| 7942 | 593 | tempitem.misc8 = 0; | |
| 7943 | 593 | tempitem.misc9 = 0; | |
| 7944 | 593 | tempitem.misc10 = 0; | |
| 7945 | 593 | tempitem.wpn = 0; | |
| 7946 | 593 | tempitem.wpn2 = 0; | |
| 7947 | 593 | tempitem.wpn3 = 0; | |
| 7948 | 593 | tempitem.wpn4 = 0; | |
| 7949 | 593 | tempitem.wpn5 = 0; | |
| 7950 | 593 | tempitem.wpn6 = 0; | |
| 7951 | 593 | tempitem.wpn7 = 0; | |
| 7952 | 593 | tempitem.wpn8 = 0; | |
| 7953 | 593 | tempitem.wpn9 = 0; | |
| 7954 | 593 | tempitem.wpn10 = 0; | |
| 7955 | 593 | break; | |
| 7956 | } | ||
| 7957 | case itype_wand: | ||
| 7958 | { | ||
| 7959 | 287 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag5); | |
| 7960 | 287 | tempitem.misc1 = 0; | |
| 7961 | 287 | tempitem.misc2 = 0; | |
| 7962 | 287 | tempitem.misc3 = 0; | |
| 7963 | 287 | tempitem.misc4 = 0; | |
| 7964 | 287 | tempitem.misc5 = 0; | |
| 7965 | 287 | tempitem.misc6 = 0; | |
| 7966 | 287 | tempitem.misc7 = 0; | |
| 7967 | 287 | tempitem.misc8 = 0; | |
| 7968 | 287 | tempitem.misc9 = 0; | |
| 7969 | 287 | tempitem.misc10 = 0; | |
| 7970 | 287 | tempitem.wpn4 = 0; | |
| 7971 | 287 | tempitem.wpn5 = 0; | |
| 7972 | 287 | tempitem.wpn6 = 0; | |
| 7973 | 287 | tempitem.wpn7 = 0; | |
| 7974 | 287 | tempitem.wpn8 = 0; | |
| 7975 | 287 | tempitem.wpn9 = 0; | |
| 7976 | 287 | tempitem.wpn10 = 0; | |
| 7977 | 287 | break; | |
| 7978 | } | ||
| 7979 | case itype_ring: | ||
| 7980 | { | ||
| 7981 | 861 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 7982 | 861 | tempitem.misc2 = 0; | |
| 7983 | 861 | tempitem.misc3 = 0; | |
| 7984 | 861 | tempitem.misc4 = 0; | |
| 7985 | 861 | tempitem.misc5 = 0; | |
| 7986 | 861 | tempitem.misc6 = 0; | |
| 7987 | 861 | tempitem.misc7 = 0; | |
| 7988 | 861 | tempitem.misc8 = 0; | |
| 7989 | 861 | tempitem.misc9 = 0; | |
| 7990 | 861 | tempitem.misc10 = 0; | |
| 7991 | 861 | tempitem.wpn = 0; | |
| 7992 | 861 | tempitem.wpn2 = 0; | |
| 7993 | 861 | tempitem.wpn3 = 0; | |
| 7994 | 861 | tempitem.wpn4 = 0; | |
| 7995 | 861 | tempitem.wpn5 = 0; | |
| 7996 | 861 | tempitem.wpn6 = 0; | |
| 7997 | 861 | tempitem.wpn7 = 0; | |
| 7998 | 861 | tempitem.wpn8 = 0; | |
| 7999 | 861 | tempitem.wpn9 = 0; | |
| 8000 | 861 | tempitem.wpn10 = 0; | |
| 8001 | 861 | break; | |
| 8002 | } | ||
| 8003 | case itype_wallet: | ||
| 8004 | { | ||
| 8005 | 861 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8006 | 861 | tempitem.misc3 = 0; | |
| 8007 | 861 | tempitem.misc4 = 0; | |
| 8008 | 861 | tempitem.misc5 = 0; | |
| 8009 | 861 | tempitem.misc6 = 0; | |
| 8010 | 861 | tempitem.misc7 = 0; | |
| 8011 | 861 | tempitem.misc8 = 0; | |
| 8012 | 861 | tempitem.misc9 = 0; | |
| 8013 | 861 | tempitem.misc10 = 0; | |
| 8014 | 861 | tempitem.wpn = 0; | |
| 8015 | 861 | tempitem.wpn2 = 0; | |
| 8016 | 861 | tempitem.wpn3 = 0; | |
| 8017 | 861 | tempitem.wpn4 = 0; | |
| 8018 | 861 | tempitem.wpn5 = 0; | |
| 8019 | 861 | tempitem.wpn6 = 0; | |
| 8020 | 861 | tempitem.wpn7 = 0; | |
| 8021 | 861 | tempitem.wpn8 = 0; | |
| 8022 | 861 | tempitem.wpn9 = 0; | |
| 8023 | 861 | tempitem.wpn10 = 0; | |
| 8024 | 861 | break; | |
| 8025 | } | ||
| 8026 | case itype_amulet: | ||
| 8027 | { | ||
| 8028 | 534 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8029 | 534 | tempitem.misc1 = 0; | |
| 8030 | 534 | tempitem.misc2 = 0; | |
| 8031 | 534 | tempitem.misc3 = 0; | |
| 8032 | 534 | tempitem.misc4 = 0; | |
| 8033 | 534 | tempitem.misc5 = 0; | |
| 8034 | 534 | tempitem.misc6 = 0; | |
| 8035 | 534 | tempitem.misc7 = 0; | |
| 8036 | 534 | tempitem.misc8 = 0; | |
| 8037 | 534 | tempitem.misc9 = 0; | |
| 8038 | 534 | tempitem.misc10 = 0; | |
| 8039 | 534 | tempitem.wpn = 0; | |
| 8040 | 534 | tempitem.wpn2 = 0; | |
| 8041 | 534 | tempitem.wpn3 = 0; | |
| 8042 | 534 | tempitem.wpn4 = 0; | |
| 8043 | 534 | tempitem.wpn5 = 0; | |
| 8044 | 534 | tempitem.wpn6 = 0; | |
| 8045 | 534 | tempitem.wpn7 = 0; | |
| 8046 | 534 | tempitem.wpn8 = 0; | |
| 8047 | 534 | tempitem.wpn9 = 0; | |
| 8048 | 534 | tempitem.wpn10 = 0; | |
| 8049 | 534 | break; | |
| 8050 | } | ||
| 8051 | case itype_shield: | ||
| 8052 | { | ||
| 8053 | 821 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8054 | 821 | tempitem.misc3 = 0; | |
| 8055 | 821 | tempitem.misc4 = 0; | |
| 8056 | 821 | tempitem.misc5 = 0; | |
| 8057 | 821 | tempitem.misc6 = 0; | |
| 8058 | 821 | tempitem.misc7 = 0; | |
| 8059 | 821 | tempitem.misc8 = 0; | |
| 8060 | 821 | tempitem.misc9 = 0; | |
| 8061 | 821 | tempitem.misc10 = 0; | |
| 8062 | 821 | tempitem.wpn = 0; | |
| 8063 | 821 | tempitem.wpn2 = 0; | |
| 8064 | 821 | tempitem.wpn3 = 0; | |
| 8065 | 821 | tempitem.wpn4 = 0; | |
| 8066 | 821 | tempitem.wpn5 = 0; | |
| 8067 | 821 | tempitem.wpn6 = 0; | |
| 8068 | 821 | tempitem.wpn7 = 0; | |
| 8069 | 821 | tempitem.wpn8 = 0; | |
| 8070 | 821 | tempitem.wpn9 = 0; | |
| 8071 | 821 | tempitem.wpn10 = 0; | |
| 8072 | 821 | break; | |
| 8073 | } | ||
| 8074 | case itype_bow: | ||
| 8075 | { | ||
| 8076 | 538 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8077 | 538 | tempitem.misc1 = 0; | |
| 8078 | 538 | tempitem.misc2 = 0; | |
| 8079 | 538 | tempitem.misc3 = 0; | |
| 8080 | 538 | tempitem.misc4 = 0; | |
| 8081 | 538 | tempitem.misc5 = 0; | |
| 8082 | 538 | tempitem.misc6 = 0; | |
| 8083 | 538 | tempitem.misc7 = 0; | |
| 8084 | 538 | tempitem.misc8 = 0; | |
| 8085 | 538 | tempitem.misc9 = 0; | |
| 8086 | 538 | tempitem.misc10 = 0; | |
| 8087 | 538 | tempitem.wpn = 0; | |
| 8088 | 538 | tempitem.wpn2 = 0; | |
| 8089 | 538 | tempitem.wpn3 = 0; | |
| 8090 | 538 | tempitem.wpn4 = 0; | |
| 8091 | 538 | tempitem.wpn5 = 0; | |
| 8092 | 538 | tempitem.wpn6 = 0; | |
| 8093 | 538 | tempitem.wpn7 = 0; | |
| 8094 | 538 | tempitem.wpn8 = 0; | |
| 8095 | 538 | tempitem.wpn9 = 0; | |
| 8096 | 538 | tempitem.wpn10 = 0; | |
| 8097 | 538 | break; | |
| 8098 | } | ||
| 8099 | case itype_raft: | ||
| 8100 | { | ||
| 8101 | 269 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8102 | 269 | tempitem.misc1 = 0; | |
| 8103 | 269 | tempitem.misc2 = 0; | |
| 8104 | 269 | tempitem.misc3 = 0; | |
| 8105 | 269 | tempitem.misc4 = 0; | |
| 8106 | 269 | tempitem.misc5 = 0; | |
| 8107 | 269 | tempitem.misc6 = 0; | |
| 8108 | 269 | tempitem.misc7 = 0; | |
| 8109 | 269 | tempitem.misc8 = 0; | |
| 8110 | 269 | tempitem.misc9 = 0; | |
| 8111 | 269 | tempitem.misc10 = 0; | |
| 8112 | 269 | tempitem.wpn = 0; | |
| 8113 | 269 | tempitem.wpn2 = 0; | |
| 8114 | 269 | tempitem.wpn3 = 0; | |
| 8115 | 269 | tempitem.wpn4 = 0; | |
| 8116 | 269 | tempitem.wpn5 = 0; | |
| 8117 | 269 | tempitem.wpn6 = 0; | |
| 8118 | 269 | tempitem.wpn7 = 0; | |
| 8119 | 269 | tempitem.wpn8 = 0; | |
| 8120 | 269 | tempitem.wpn9 = 0; | |
| 8121 | 269 | tempitem.wpn10 = 0; | |
| 8122 | 269 | break; | |
| 8123 | } | ||
| 8124 | case itype_ladder: | ||
| 8125 | { | ||
| 8126 | 538 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8127 | 538 | tempitem.misc1 = 0; | |
| 8128 | 538 | tempitem.misc2 = 0; | |
| 8129 | 538 | tempitem.misc3 = 0; | |
| 8130 | 538 | tempitem.misc4 = 0; | |
| 8131 | 538 | tempitem.misc5 = 0; | |
| 8132 | 538 | tempitem.misc6 = 0; | |
| 8133 | 538 | tempitem.misc7 = 0; | |
| 8134 | 538 | tempitem.misc8 = 0; | |
| 8135 | 538 | tempitem.misc9 = 0; | |
| 8136 | 538 | tempitem.misc10 = 0; | |
| 8137 | 538 | tempitem.wpn = 0; | |
| 8138 | 538 | tempitem.wpn2 = 0; | |
| 8139 | 538 | tempitem.wpn3 = 0; | |
| 8140 | 538 | tempitem.wpn4 = 0; | |
| 8141 | 538 | tempitem.wpn5 = 0; | |
| 8142 | 538 | tempitem.wpn6 = 0; | |
| 8143 | 538 | tempitem.wpn7 = 0; | |
| 8144 | 538 | tempitem.wpn8 = 0; | |
| 8145 | 538 | tempitem.wpn9 = 0; | |
| 8146 | 538 | tempitem.wpn10 = 0; | |
| 8147 | 538 | break; | |
| 8148 | } | ||
| 8149 | case itype_book: | ||
| 8150 | { | ||
| 8151 | 285 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8152 | 285 | tempitem.misc1 = 0; | |
| 8153 | 285 | tempitem.misc2 = 0; | |
| 8154 | 285 | tempitem.misc3 = 0; | |
| 8155 | 285 | tempitem.misc4 = 0; | |
| 8156 | 285 | tempitem.misc5 = 0; | |
| 8157 | 285 | tempitem.misc6 = 0; | |
| 8158 | 285 | tempitem.misc7 = 0; | |
| 8159 | 285 | tempitem.misc8 = 0; | |
| 8160 | 285 | tempitem.misc9 = 0; | |
| 8161 | 285 | tempitem.misc10 = 0; | |
| 8162 | 285 | tempitem.wpn3 = 0; | |
| 8163 | 285 | tempitem.wpn4 = 0; | |
| 8164 | 285 | tempitem.wpn5 = 0; | |
| 8165 | 285 | tempitem.wpn6 = 0; | |
| 8166 | 285 | tempitem.wpn7 = 0; | |
| 8167 | 285 | tempitem.wpn8 = 0; | |
| 8168 | 285 | tempitem.wpn9 = 0; | |
| 8169 | 285 | tempitem.wpn10 = 0; | |
| 8170 | 285 | break; | |
| 8171 | } | ||
| 8172 | case itype_magickey: | ||
| 8173 | { | ||
| 8174 | 269 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8175 | 269 | tempitem.misc1 = 0; | |
| 8176 | 269 | tempitem.misc2 = 0; | |
| 8177 | 269 | tempitem.misc3 = 0; | |
| 8178 | 269 | tempitem.misc4 = 0; | |
| 8179 | 269 | tempitem.misc5 = 0; | |
| 8180 | 269 | tempitem.misc6 = 0; | |
| 8181 | 269 | tempitem.misc7 = 0; | |
| 8182 | 269 | tempitem.misc8 = 0; | |
| 8183 | 269 | tempitem.misc9 = 0; | |
| 8184 | 269 | tempitem.misc10 = 0; | |
| 8185 | 269 | tempitem.wpn = 0; | |
| 8186 | 269 | tempitem.wpn2 = 0; | |
| 8187 | 269 | tempitem.wpn3 = 0; | |
| 8188 | 269 | tempitem.wpn4 = 0; | |
| 8189 | 269 | tempitem.wpn5 = 0; | |
| 8190 | 269 | tempitem.wpn6 = 0; | |
| 8191 | 269 | tempitem.wpn7 = 0; | |
| 8192 | 269 | tempitem.wpn8 = 0; | |
| 8193 | 269 | tempitem.wpn9 = 0; | |
| 8194 | 269 | tempitem.wpn10 = 0; | |
| 8195 | 269 | break; | |
| 8196 | } | ||
| 8197 | case itype_bracelet: | ||
| 8198 | { | ||
| 8199 | 813 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8200 | 813 | tempitem.misc1 = 0; | |
| 8201 | 813 | tempitem.misc2 = 0; | |
| 8202 | 813 | tempitem.misc3 = 0; | |
| 8203 | 813 | tempitem.misc4 = 0; | |
| 8204 | 813 | tempitem.misc5 = 0; | |
| 8205 | 813 | tempitem.misc6 = 0; | |
| 8206 | 813 | tempitem.misc7 = 0; | |
| 8207 | 813 | tempitem.misc8 = 0; | |
| 8208 | 813 | tempitem.misc9 = 0; | |
| 8209 | 813 | tempitem.misc10 = 0; | |
| 8210 | 813 | tempitem.wpn = 0; | |
| 8211 | 813 | tempitem.wpn2 = 0; | |
| 8212 | 813 | tempitem.wpn3 = 0; | |
| 8213 | 813 | tempitem.wpn4 = 0; | |
| 8214 | 813 | tempitem.wpn5 = 0; | |
| 8215 | 813 | tempitem.wpn6 = 0; | |
| 8216 | 813 | tempitem.wpn7 = 0; | |
| 8217 | 813 | tempitem.wpn8 = 0; | |
| 8218 | 813 | tempitem.wpn9 = 0; | |
| 8219 | 813 | tempitem.wpn10 = 0; | |
| 8220 | 813 | break; | |
| 8221 | } | ||
| 8222 | case itype_flippers: | ||
| 8223 | { | ||
| 8224 | 271 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8225 | 271 | tempitem.misc1 = 0; | |
| 8226 | 271 | tempitem.misc2 = 0; | |
| 8227 | 271 | tempitem.misc3 = 0; | |
| 8228 | 271 | tempitem.misc4 = 0; | |
| 8229 | 271 | tempitem.misc5 = 0; | |
| 8230 | 271 | tempitem.misc6 = 0; | |
| 8231 | 271 | tempitem.misc7 = 0; | |
| 8232 | 271 | tempitem.misc8 = 0; | |
| 8233 | 271 | tempitem.misc9 = 0; | |
| 8234 | 271 | tempitem.misc10 = 0; | |
| 8235 | 271 | tempitem.wpn = 0; | |
| 8236 | 271 | tempitem.wpn2 = 0; | |
| 8237 | 271 | tempitem.wpn3 = 0; | |
| 8238 | 271 | tempitem.wpn4 = 0; | |
| 8239 | 271 | tempitem.wpn5 = 0; | |
| 8240 | 271 | tempitem.wpn6 = 0; | |
| 8241 | 271 | tempitem.wpn7 = 0; | |
| 8242 | 271 | tempitem.wpn8 = 0; | |
| 8243 | 271 | tempitem.wpn9 = 0; | |
| 8244 | 271 | tempitem.wpn10 = 0; | |
| 8245 | 271 | break; | |
| 8246 | } | ||
| 8247 | case itype_boots: | ||
| 8248 | { | ||
| 8249 | 273 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8250 | 273 | tempitem.misc1 = 0; | |
| 8251 | 273 | tempitem.misc2 = 0; | |
| 8252 | 273 | tempitem.misc3 = 0; | |
| 8253 | 273 | tempitem.misc4 = 0; | |
| 8254 | 273 | tempitem.misc5 = 0; | |
| 8255 | 273 | tempitem.misc6 = 0; | |
| 8256 | 273 | tempitem.misc7 = 0; | |
| 8257 | 273 | tempitem.misc8 = 0; | |
| 8258 | 273 | tempitem.misc9 = 0; | |
| 8259 | 273 | tempitem.misc10 = 0; | |
| 8260 | 273 | tempitem.wpn = 0; | |
| 8261 | 273 | tempitem.wpn2 = 0; | |
| 8262 | 273 | tempitem.wpn3 = 0; | |
| 8263 | 273 | tempitem.wpn4 = 0; | |
| 8264 | 273 | tempitem.wpn5 = 0; | |
| 8265 | 273 | tempitem.wpn6 = 0; | |
| 8266 | 273 | tempitem.wpn7 = 0; | |
| 8267 | 273 | tempitem.wpn8 = 0; | |
| 8268 | 273 | tempitem.wpn9 = 0; | |
| 8269 | 273 | tempitem.wpn10 = 0; | |
| 8270 | 273 | break; | |
| 8271 | } | ||
| 8272 | case itype_hookshot: | ||
| 8273 | { | ||
| 8274 | 540 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8275 | 540 | tempitem.misc5 = 0; | |
| 8276 | 540 | tempitem.misc6 = 0; | |
| 8277 | 540 | tempitem.misc7 = 0; | |
| 8278 | 540 | tempitem.misc8 = 0; | |
| 8279 | 540 | tempitem.misc9 = 0; | |
| 8280 | 540 | tempitem.misc10 = 0; | |
| 8281 | 540 | tempitem.wpn5 = 0; | |
| 8282 | 540 | tempitem.wpn6 = 0; | |
| 8283 | 540 | tempitem.wpn7 = 0; | |
| 8284 | 540 | tempitem.wpn8 = 0; | |
| 8285 | 540 | tempitem.wpn9 = 0; | |
| 8286 | 540 | tempitem.wpn10 = 0; | |
| 8287 | 540 | break; | |
| 8288 | } | ||
| 8289 | case itype_lens: | ||
| 8290 | { | ||
| 8291 | 245 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8292 | 245 | tempitem.misc2 = 0; | |
| 8293 | 245 | tempitem.misc3 = 0; | |
| 8294 | 245 | tempitem.misc4 = 0; | |
| 8295 | 245 | tempitem.misc5 = 0; | |
| 8296 | 245 | tempitem.misc6 = 0; | |
| 8297 | 245 | tempitem.misc7 = 0; | |
| 8298 | 245 | tempitem.misc8 = 0; | |
| 8299 | 245 | tempitem.misc9 = 0; | |
| 8300 | 245 | tempitem.misc10 = 0; | |
| 8301 | 245 | tempitem.wpn = 0; | |
| 8302 | 245 | tempitem.wpn2 = 0; | |
| 8303 | 245 | tempitem.wpn3 = 0; | |
| 8304 | 245 | tempitem.wpn4 = 0; | |
| 8305 | 245 | tempitem.wpn5 = 0; | |
| 8306 | 245 | tempitem.wpn6 = 0; | |
| 8307 | 245 | tempitem.wpn7 = 0; | |
| 8308 | 245 | tempitem.wpn8 = 0; | |
| 8309 | 245 | tempitem.wpn9 = 0; | |
| 8310 | 245 | tempitem.wpn10 = 0; | |
| 8311 | 245 | break; | |
| 8312 | } | ||
| 8313 | case itype_hammer: | ||
| 8314 | { | ||
| 8315 | 271 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8316 | 271 | tempitem.misc1 = 0; | |
| 8317 | 271 | tempitem.misc2 = 0; | |
| 8318 | 271 | tempitem.misc3 = 0; | |
| 8319 | 271 | tempitem.misc4 = 0; | |
| 8320 | 271 | tempitem.misc5 = 0; | |
| 8321 | 271 | tempitem.misc6 = 0; | |
| 8322 | 271 | tempitem.misc7 = 0; | |
| 8323 | 271 | tempitem.misc8 = 0; | |
| 8324 | 271 | tempitem.misc9 = 0; | |
| 8325 | 271 | tempitem.misc10 = 0; | |
| 8326 | 271 | tempitem.wpn3 = 0; | |
| 8327 | 271 | tempitem.wpn4 = 0; | |
| 8328 | 271 | tempitem.wpn5 = 0; | |
| 8329 | 271 | tempitem.wpn6 = 0; | |
| 8330 | 271 | tempitem.wpn7 = 0; | |
| 8331 | 271 | tempitem.wpn8 = 0; | |
| 8332 | 271 | tempitem.wpn9 = 0; | |
| 8333 | 271 | tempitem.wpn10 = 0; | |
| 8334 | 271 | break; | |
| 8335 | } | ||
| 8336 | case itype_divinefire: | ||
| 8337 | { | ||
| 8338 | 269 | tempitem.flags &= ~ (item_flag1 | item_flag4 | item_flag5); | |
| 8339 | 269 | tempitem.misc3 = 0; | |
| 8340 | 269 | tempitem.misc4 = 0; | |
| 8341 | 269 | tempitem.misc5 = 0; | |
| 8342 | 269 | tempitem.misc6 = 0; | |
| 8343 | 269 | tempitem.misc7 = 0; | |
| 8344 | 269 | tempitem.misc8 = 0; | |
| 8345 | 269 | tempitem.misc9 = 0; | |
| 8346 | 269 | tempitem.misc10 = 0; | |
| 8347 | 269 | tempitem.wpn6 = 0; | |
| 8348 | 269 | tempitem.wpn7 = 0; | |
| 8349 | 269 | tempitem.wpn8 = 0; | |
| 8350 | 269 | tempitem.wpn9 = 0; | |
| 8351 | 269 | tempitem.wpn10 = 0; | |
| 8352 | 269 | break; | |
| 8353 | } | ||
| 8354 | case itype_divineescape: | ||
| 8355 | { | ||
| 8356 | 269 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8357 | 269 | tempitem.misc2 = 0; | |
| 8358 | 269 | tempitem.misc3 = 0; | |
| 8359 | 269 | tempitem.misc4 = 0; | |
| 8360 | 269 | tempitem.misc5 = 0; | |
| 8361 | 269 | tempitem.misc6 = 0; | |
| 8362 | 269 | tempitem.misc7 = 0; | |
| 8363 | 269 | tempitem.misc8 = 0; | |
| 8364 | 269 | tempitem.misc9 = 0; | |
| 8365 | 269 | tempitem.misc10 = 0; | |
| 8366 | 269 | tempitem.wpn = 0; | |
| 8367 | 269 | tempitem.wpn2 = 0; | |
| 8368 | 269 | tempitem.wpn3 = 0; | |
| 8369 | 269 | tempitem.wpn4 = 0; | |
| 8370 | 269 | tempitem.wpn5 = 0; | |
| 8371 | 269 | tempitem.wpn6 = 0; | |
| 8372 | 269 | tempitem.wpn7 = 0; | |
| 8373 | 269 | tempitem.wpn8 = 0; | |
| 8374 | 269 | tempitem.wpn9 = 0; | |
| 8375 | 269 | tempitem.wpn10 = 0; | |
| 8376 | 269 | break; | |
| 8377 | } | ||
| 8378 | case itype_divineprotection: | ||
| 8379 | { | ||
| 8380 | 269 | tempitem.flags &= ~ (item_flag5); | |
| 8381 | 269 | tempitem.misc2 = 0; | |
| 8382 | 269 | tempitem.misc3 = 0; | |
| 8383 | 269 | tempitem.misc4 = 0; | |
| 8384 | 269 | tempitem.misc5 = 0; | |
| 8385 | 269 | tempitem.misc6 = 0; | |
| 8386 | 269 | tempitem.misc7 = 0; | |
| 8387 | 269 | tempitem.misc8 = 0; | |
| 8388 | 269 | tempitem.misc9 = 0; | |
| 8389 | 269 | tempitem.misc10 = 0; | |
| 8390 | 269 | break; | |
| 8391 | } | ||
| 8392 | case itype_bomb: | ||
| 8393 | { | ||
| 8394 | 285 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8395 | 285 | tempitem.misc4 = 0; | |
| 8396 | 285 | tempitem.misc5 = 0; | |
| 8397 | 285 | tempitem.misc6 = 0; | |
| 8398 | 285 | tempitem.misc7 = 0; | |
| 8399 | 285 | tempitem.misc8 = 0; | |
| 8400 | 285 | tempitem.misc9 = 0; | |
| 8401 | 285 | tempitem.misc10 = 0; | |
| 8402 | 285 | tempitem.wpn3 = 0; | |
| 8403 | 285 | tempitem.wpn4 = 0; | |
| 8404 | 285 | tempitem.wpn5 = 0; | |
| 8405 | 285 | tempitem.wpn6 = 0; | |
| 8406 | 285 | tempitem.wpn7 = 0; | |
| 8407 | 285 | tempitem.wpn8 = 0; | |
| 8408 | 285 | tempitem.wpn9 = 0; | |
| 8409 | 285 | tempitem.wpn10 = 0; | |
| 8410 | 285 | break; | |
| 8411 | } | ||
| 8412 | case itype_sbomb: | ||
| 8413 | { | ||
| 8414 | 271 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8415 | 271 | tempitem.misc4 = 0; | |
| 8416 | 271 | tempitem.misc5 = 0; | |
| 8417 | 271 | tempitem.misc6 = 0; | |
| 8418 | 271 | tempitem.misc7 = 0; | |
| 8419 | 271 | tempitem.misc8 = 0; | |
| 8420 | 271 | tempitem.misc9 = 0; | |
| 8421 | 271 | tempitem.misc10 = 0; | |
| 8422 | 271 | tempitem.wpn3 = 0; | |
| 8423 | 271 | tempitem.wpn4 = 0; | |
| 8424 | 271 | tempitem.wpn5 = 0; | |
| 8425 | 271 | tempitem.wpn6 = 0; | |
| 8426 | 271 | tempitem.wpn7 = 0; | |
| 8427 | 271 | tempitem.wpn8 = 0; | |
| 8428 | 271 | tempitem.wpn9 = 0; | |
| 8429 | 271 | tempitem.wpn10 = 0; | |
| 8430 | 271 | break; | |
| 8431 | } | ||
| 8432 | case itype_clock: | ||
| 8433 | { | ||
| 8434 | 271 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8435 | 271 | tempitem.misc2 = 0; | |
| 8436 | 271 | tempitem.misc3 = 0; | |
| 8437 | 271 | tempitem.misc4 = 0; | |
| 8438 | 271 | tempitem.misc5 = 0; | |
| 8439 | 271 | tempitem.misc6 = 0; | |
| 8440 | 271 | tempitem.misc7 = 0; | |
| 8441 | 271 | tempitem.misc8 = 0; | |
| 8442 | 271 | tempitem.misc9 = 0; | |
| 8443 | 271 | tempitem.misc10 = 0; | |
| 8444 | 271 | tempitem.wpn = 0; | |
| 8445 | 271 | tempitem.wpn2 = 0; | |
| 8446 | 271 | tempitem.wpn3 = 0; | |
| 8447 | 271 | tempitem.wpn4 = 0; | |
| 8448 | 271 | tempitem.wpn5 = 0; | |
| 8449 | 271 | tempitem.wpn6 = 0; | |
| 8450 | 271 | tempitem.wpn7 = 0; | |
| 8451 | 271 | tempitem.wpn8 = 0; | |
| 8452 | 271 | tempitem.wpn9 = 0; | |
| 8453 | 271 | tempitem.wpn10 = 0; | |
| 8454 | 271 | break; | |
| 8455 | } | ||
| 8456 | case itype_key: | ||
| 8457 | { | ||
| 8458 | 269 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8459 | 269 | tempitem.misc1 = 0; | |
| 8460 | 269 | tempitem.misc2 = 0; | |
| 8461 | 269 | tempitem.misc3 = 0; | |
| 8462 | 269 | tempitem.misc4 = 0; | |
| 8463 | 269 | tempitem.misc5 = 0; | |
| 8464 | 269 | tempitem.misc6 = 0; | |
| 8465 | 269 | tempitem.misc7 = 0; | |
| 8466 | 269 | tempitem.misc8 = 0; | |
| 8467 | 269 | tempitem.misc9 = 0; | |
| 8468 | 269 | tempitem.misc10 = 0; | |
| 8469 | 269 | tempitem.wpn = 0; | |
| 8470 | 269 | tempitem.wpn2 = 0; | |
| 8471 | 269 | tempitem.wpn3 = 0; | |
| 8472 | 269 | tempitem.wpn4 = 0; | |
| 8473 | 269 | tempitem.wpn5 = 0; | |
| 8474 | 269 | tempitem.wpn6 = 0; | |
| 8475 | 269 | tempitem.wpn7 = 0; | |
| 8476 | 269 | tempitem.wpn8 = 0; | |
| 8477 | 269 | tempitem.wpn9 = 0; | |
| 8478 | 269 | tempitem.wpn10 = 0; | |
| 8479 | 269 | break; | |
| 8480 | } | ||
| 8481 | case itype_magiccontainer: | ||
| 8482 | { | ||
| 8483 | 273 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8484 | 273 | tempitem.misc1 = 0; | |
| 8485 | 273 | tempitem.misc2 = 0; | |
| 8486 | 273 | tempitem.misc3 = 0; | |
| 8487 | 273 | tempitem.misc4 = 0; | |
| 8488 | 273 | tempitem.misc5 = 0; | |
| 8489 | 273 | tempitem.misc6 = 0; | |
| 8490 | 273 | tempitem.misc7 = 0; | |
| 8491 | 273 | tempitem.misc8 = 0; | |
| 8492 | 273 | tempitem.misc9 = 0; | |
| 8493 | 273 | tempitem.misc10 = 0; | |
| 8494 | 273 | tempitem.wpn = 0; | |
| 8495 | 273 | tempitem.wpn2 = 0; | |
| 8496 | 273 | tempitem.wpn3 = 0; | |
| 8497 | 273 | tempitem.wpn4 = 0; | |
| 8498 | 273 | tempitem.wpn5 = 0; | |
| 8499 | 273 | tempitem.wpn6 = 0; | |
| 8500 | 273 | tempitem.wpn7 = 0; | |
| 8501 | 273 | tempitem.wpn8 = 0; | |
| 8502 | 273 | tempitem.wpn9 = 0; | |
| 8503 | 273 | tempitem.wpn10 = 0; | |
| 8504 | 273 | break; | |
| 8505 | } | ||
| 8506 | case itype_triforcepiece: | ||
| 8507 | { | ||
| 8508 | 538 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8509 | 538 | tempitem.misc3 = 0; | |
| 8510 | 538 | tempitem.misc4 = 0; | |
| 8511 | 538 | tempitem.misc5 = 0; | |
| 8512 | 538 | tempitem.misc6 = 0; | |
| 8513 | 538 | tempitem.misc7 = 0; | |
| 8514 | 538 | tempitem.misc8 = 0; | |
| 8515 | 538 | tempitem.misc9 = 0; | |
| 8516 | 538 | tempitem.misc10 = 0; | |
| 8517 | 538 | tempitem.wpn = 0; | |
| 8518 | 538 | tempitem.wpn2 = 0; | |
| 8519 | 538 | tempitem.wpn3 = 0; | |
| 8520 | 538 | tempitem.wpn4 = 0; | |
| 8521 | 538 | tempitem.wpn5 = 0; | |
| 8522 | 538 | tempitem.wpn6 = 0; | |
| 8523 | 538 | tempitem.wpn7 = 0; | |
| 8524 | 538 | tempitem.wpn8 = 0; | |
| 8525 | 538 | tempitem.wpn9 = 0; | |
| 8526 | 538 | tempitem.wpn10 = 0; | |
| 8527 | 538 | break; | |
| 8528 | } | ||
| 8529 | case itype_map: case itype_compass: case itype_bosskey: | ||
| 8530 | { | ||
| 8531 | 811 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8532 | 811 | tempitem.misc1 = 0; | |
| 8533 | 811 | tempitem.misc2 = 0; | |
| 8534 | 811 | tempitem.misc3 = 0; | |
| 8535 | 811 | tempitem.misc4 = 0; | |
| 8536 | 811 | tempitem.misc5 = 0; | |
| 8537 | 811 | tempitem.misc6 = 0; | |
| 8538 | 811 | tempitem.misc7 = 0; | |
| 8539 | 811 | tempitem.misc8 = 0; | |
| 8540 | 811 | tempitem.misc9 = 0; | |
| 8541 | 811 | tempitem.misc10 = 0; | |
| 8542 | 811 | tempitem.wpn = 0; | |
| 8543 | 811 | tempitem.wpn2 = 0; | |
| 8544 | 811 | tempitem.wpn3 = 0; | |
| 8545 | 811 | tempitem.wpn4 = 0; | |
| 8546 | 811 | tempitem.wpn5 = 0; | |
| 8547 | 811 | tempitem.wpn6 = 0; | |
| 8548 | 811 | tempitem.wpn7 = 0; | |
| 8549 | 811 | tempitem.wpn8 = 0; | |
| 8550 | 811 | tempitem.wpn9 = 0; | |
| 8551 | 811 | tempitem.wpn10 = 0; | |
| 8552 | 811 | break; | |
| 8553 | } | ||
| 8554 | case itype_quiver: | ||
| 8555 | { | ||
| 8556 | 1076 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8557 | 1076 | tempitem.misc3 = 0; | |
| 8558 | 1076 | tempitem.misc4 = 0; | |
| 8559 | 1076 | tempitem.misc5 = 0; | |
| 8560 | 1076 | tempitem.misc6 = 0; | |
| 8561 | 1076 | tempitem.misc7 = 0; | |
| 8562 | 1076 | tempitem.misc8 = 0; | |
| 8563 | 1076 | tempitem.misc9 = 0; | |
| 8564 | 1076 | tempitem.misc10 = 0; | |
| 8565 | 1076 | tempitem.wpn = 0; | |
| 8566 | 1076 | tempitem.wpn2 = 0; | |
| 8567 | 1076 | tempitem.wpn3 = 0; | |
| 8568 | 1076 | tempitem.wpn4 = 0; | |
| 8569 | 1076 | tempitem.wpn5 = 0; | |
| 8570 | 1076 | tempitem.wpn6 = 0; | |
| 8571 | 1076 | tempitem.wpn7 = 0; | |
| 8572 | 1076 | tempitem.wpn8 = 0; | |
| 8573 | 1076 | tempitem.wpn9 = 0; | |
| 8574 | 1076 | tempitem.wpn10 = 0; | |
| 8575 | 1076 | break; | |
| 8576 | } | ||
| 8577 | case itype_lkey: | ||
| 8578 | { | ||
| 8579 | 759 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8580 | 759 | tempitem.misc1 = 0; | |
| 8581 | 759 | tempitem.misc2 = 0; | |
| 8582 | 759 | tempitem.misc3 = 0; | |
| 8583 | 759 | tempitem.misc4 = 0; | |
| 8584 | 759 | tempitem.misc5 = 0; | |
| 8585 | 759 | tempitem.misc6 = 0; | |
| 8586 | 759 | tempitem.misc7 = 0; | |
| 8587 | 759 | tempitem.misc8 = 0; | |
| 8588 | 759 | tempitem.misc9 = 0; | |
| 8589 | 759 | tempitem.misc10 = 0; | |
| 8590 | 759 | tempitem.wpn = 0; | |
| 8591 | 759 | tempitem.wpn2 = 0; | |
| 8592 | 759 | tempitem.wpn3 = 0; | |
| 8593 | 759 | tempitem.wpn4 = 0; | |
| 8594 | 759 | tempitem.wpn5 = 0; | |
| 8595 | 759 | tempitem.wpn6 = 0; | |
| 8596 | 759 | tempitem.wpn7 = 0; | |
| 8597 | 759 | tempitem.wpn8 = 0; | |
| 8598 | 759 | tempitem.wpn9 = 0; | |
| 8599 | 759 | tempitem.wpn10 = 0; | |
| 8600 | 759 | break; | |
| 8601 | } | ||
| 8602 | case itype_cbyrna: | ||
| 8603 | { | ||
| 8604 | 269 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag5); | |
| 8605 | 269 | tempitem.misc4 = 0; | |
| 8606 | 269 | tempitem.misc5 = 0; | |
| 8607 | 269 | tempitem.misc6 = 0; | |
| 8608 | 269 | tempitem.misc7 = 0; | |
| 8609 | 269 | tempitem.misc8 = 0; | |
| 8610 | 269 | tempitem.misc9 = 0; | |
| 8611 | 269 | tempitem.misc10 = 0; | |
| 8612 | 269 | tempitem.wpn6 = 0; | |
| 8613 | 269 | tempitem.wpn7 = 0; | |
| 8614 | 269 | tempitem.wpn8 = 0; | |
| 8615 | 269 | tempitem.wpn9 = 0; | |
| 8616 | 269 | tempitem.wpn10 = 0; | |
| 8617 | 269 | break; | |
| 8618 | } | ||
| 8619 | case itype_rupee: case itype_arrowammo: | ||
| 8620 | { | ||
| 8621 | 3150 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8622 | 3150 | tempitem.misc1 = 0; | |
| 8623 | 3150 | tempitem.misc2 = 0; | |
| 8624 | 3150 | tempitem.misc3 = 0; | |
| 8625 | 3150 | tempitem.misc4 = 0; | |
| 8626 | 3150 | tempitem.misc5 = 0; | |
| 8627 | 3150 | tempitem.misc6 = 0; | |
| 8628 | 3150 | tempitem.misc7 = 0; | |
| 8629 | 3150 | tempitem.misc8 = 0; | |
| 8630 | 3150 | tempitem.misc9 = 0; | |
| 8631 | 3150 | tempitem.misc10 = 0; | |
| 8632 | 3150 | tempitem.wpn = 0; | |
| 8633 | 3150 | tempitem.wpn2 = 0; | |
| 8634 | 3150 | tempitem.wpn3 = 0; | |
| 8635 | 3150 | tempitem.wpn4 = 0; | |
| 8636 | 3150 | tempitem.wpn5 = 0; | |
| 8637 | 3150 | tempitem.wpn6 = 0; | |
| 8638 | 3150 | tempitem.wpn7 = 0; | |
| 8639 | 3150 | tempitem.wpn8 = 0; | |
| 8640 | 3150 | tempitem.wpn9 = 0; | |
| 8641 | 3150 | tempitem.wpn10 = 0; | |
| 8642 | 3150 | break; | |
| 8643 | } | ||
| 8644 | case itype_fairy: | ||
| 8645 | { | ||
| 8646 | 523 | tempitem.flags &= ~ (item_flag3 | item_flag4 | item_flag5); | |
| 8647 | 523 | tempitem.misc4 = 0; | |
| 8648 | 523 | tempitem.misc5 = 0; | |
| 8649 | 523 | tempitem.misc6 = 0; | |
| 8650 | 523 | tempitem.misc7 = 0; | |
| 8651 | 523 | tempitem.misc8 = 0; | |
| 8652 | 523 | tempitem.misc9 = 0; | |
| 8653 | 523 | tempitem.misc10 = 0; | |
| 8654 | 523 | tempitem.wpn = 0; | |
| 8655 | 523 | tempitem.wpn2 = 0; | |
| 8656 | 523 | tempitem.wpn3 = 0; | |
| 8657 | 523 | tempitem.wpn4 = 0; | |
| 8658 | 523 | tempitem.wpn5 = 0; | |
| 8659 | 523 | tempitem.wpn6 = 0; | |
| 8660 | 523 | tempitem.wpn7 = 0; | |
| 8661 | 523 | tempitem.wpn8 = 0; | |
| 8662 | 523 | tempitem.wpn9 = 0; | |
| 8663 | 523 | tempitem.wpn10 = 0; | |
| 8664 | 523 | break; | |
| 8665 | } | ||
| 8666 | case itype_magic: case itype_heart: case itype_heartcontainer: case itype_heartpiece: case itype_killem: case itype_bombammo: | ||
| 8667 | { | ||
| 8668 | 2766 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8669 | 2766 | tempitem.misc1 = 0; | |
| 8670 | 2766 | tempitem.misc2 = 0; | |
| 8671 | 2766 | tempitem.misc3 = 0; | |
| 8672 | 2766 | tempitem.misc4 = 0; | |
| 8673 | 2766 | tempitem.misc5 = 0; | |
| 8674 | 2766 | tempitem.misc6 = 0; | |
| 8675 | 2766 | tempitem.misc7 = 0; | |
| 8676 | 2766 | tempitem.misc8 = 0; | |
| 8677 | 2766 | tempitem.misc9 = 0; | |
| 8678 | 2766 | tempitem.misc10 = 0; | |
| 8679 | 2766 | tempitem.wpn = 0; | |
| 8680 | 2766 | tempitem.wpn2 = 0; | |
| 8681 | 2766 | tempitem.wpn3 = 0; | |
| 8682 | 2766 | tempitem.wpn4 = 0; | |
| 8683 | 2766 | tempitem.wpn5 = 0; | |
| 8684 | 2766 | tempitem.wpn6 = 0; | |
| 8685 | 2766 | tempitem.wpn7 = 0; | |
| 8686 | 2766 | tempitem.wpn8 = 0; | |
| 8687 | 2766 | tempitem.wpn9 = 0; | |
| 8688 | 2766 | tempitem.wpn10 = 0; | |
| 8689 | 2766 | break; | |
| 8690 | } | ||
| 8691 | case itype_bombbag: | ||
| 8692 | { | ||
| 8693 | 1076 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8694 | 1076 | tempitem.misc3 = 0; | |
| 8695 | 1076 | tempitem.misc4 = 0; | |
| 8696 | 1076 | tempitem.misc5 = 0; | |
| 8697 | 1076 | tempitem.misc6 = 0; | |
| 8698 | 1076 | tempitem.misc7 = 0; | |
| 8699 | 1076 | tempitem.misc8 = 0; | |
| 8700 | 1076 | tempitem.misc9 = 0; | |
| 8701 | 1076 | tempitem.misc10 = 0; | |
| 8702 | 1076 | tempitem.wpn = 0; | |
| 8703 | 1076 | tempitem.wpn2 = 0; | |
| 8704 | 1076 | tempitem.wpn3 = 0; | |
| 8705 | 1076 | tempitem.wpn4 = 0; | |
| 8706 | 1076 | tempitem.wpn5 = 0; | |
| 8707 | 1076 | tempitem.wpn6 = 0; | |
| 8708 | 1076 | tempitem.wpn7 = 0; | |
| 8709 | 1076 | tempitem.wpn8 = 0; | |
| 8710 | 1076 | tempitem.wpn9 = 0; | |
| 8711 | 1076 | tempitem.wpn10 = 0; | |
| 8712 | 1076 | break; | |
| 8713 | } | ||
| 8714 | case itype_rocs: | ||
| 8715 | { | ||
| 8716 | 269 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8717 | 269 | tempitem.misc1 = 0; | |
| 8718 | 269 | tempitem.misc2 = 0; | |
| 8719 | 269 | tempitem.misc3 = 0; | |
| 8720 | 269 | tempitem.misc4 = 0; | |
| 8721 | 269 | tempitem.misc5 = 0; | |
| 8722 | 269 | tempitem.misc6 = 0; | |
| 8723 | 269 | tempitem.misc7 = 0; | |
| 8724 | 269 | tempitem.misc8 = 0; | |
| 8725 | 269 | tempitem.misc9 = 0; | |
| 8726 | 269 | tempitem.misc10 = 0; | |
| 8727 | 269 | tempitem.wpn = 0; | |
| 8728 | 269 | tempitem.wpn2 = 0; | |
| 8729 | 269 | tempitem.wpn3 = 0; | |
| 8730 | 269 | tempitem.wpn4 = 0; | |
| 8731 | 269 | tempitem.wpn5 = 0; | |
| 8732 | 269 | tempitem.wpn6 = 0; | |
| 8733 | 269 | tempitem.wpn7 = 0; | |
| 8734 | 269 | tempitem.wpn8 = 0; | |
| 8735 | 269 | tempitem.wpn9 = 0; | |
| 8736 | 269 | tempitem.wpn10 = 0; | |
| 8737 | 269 | break; | |
| 8738 | } | ||
| 8739 | case itype_hoverboots: | ||
| 8740 | { | ||
| 8741 | 269 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8742 | 269 | tempitem.misc2 = 0; | |
| 8743 | 269 | tempitem.misc3 = 0; | |
| 8744 | 269 | tempitem.misc4 = 0; | |
| 8745 | 269 | tempitem.misc5 = 0; | |
| 8746 | 269 | tempitem.misc6 = 0; | |
| 8747 | 269 | tempitem.misc7 = 0; | |
| 8748 | 269 | tempitem.misc8 = 0; | |
| 8749 | 269 | tempitem.misc9 = 0; | |
| 8750 | 269 | tempitem.misc10 = 0; | |
| 8751 | 269 | tempitem.wpn2 = 0; | |
| 8752 | 269 | tempitem.wpn3 = 0; | |
| 8753 | 269 | tempitem.wpn4 = 0; | |
| 8754 | 269 | tempitem.wpn5 = 0; | |
| 8755 | 269 | tempitem.wpn6 = 0; | |
| 8756 | 269 | tempitem.wpn7 = 0; | |
| 8757 | 269 | tempitem.wpn8 = 0; | |
| 8758 | 269 | tempitem.wpn9 = 0; | |
| 8759 | 269 | tempitem.wpn10 = 0; | |
| 8760 | 269 | break; | |
| 8761 | } | ||
| 8762 | case itype_spinscroll: | ||
| 8763 | { | ||
| 8764 | 269 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8765 | 269 | tempitem.misc2 = 0; | |
| 8766 | 269 | tempitem.misc3 = 0; | |
| 8767 | 269 | tempitem.misc4 = 0; | |
| 8768 | 269 | tempitem.misc5 = 0; | |
| 8769 | 269 | tempitem.misc6 = 0; | |
| 8770 | 269 | tempitem.misc7 = 0; | |
| 8771 | 269 | tempitem.misc8 = 0; | |
| 8772 | 269 | tempitem.misc9 = 0; | |
| 8773 | 269 | tempitem.misc10 = 0; | |
| 8774 | 269 | tempitem.wpn = 0; | |
| 8775 | 269 | tempitem.wpn2 = 0; | |
| 8776 | 269 | tempitem.wpn3 = 0; | |
| 8777 | 269 | tempitem.wpn4 = 0; | |
| 8778 | 269 | tempitem.wpn5 = 0; | |
| 8779 | 269 | tempitem.wpn6 = 0; | |
| 8780 | 269 | tempitem.wpn7 = 0; | |
| 8781 | 269 | tempitem.wpn8 = 0; | |
| 8782 | 269 | tempitem.wpn9 = 0; | |
| 8783 | 269 | tempitem.wpn10 = 0; | |
| 8784 | 269 | break; | |
| 8785 | } | ||
| 8786 | case itype_crossscroll: | ||
| 8787 | { | ||
| 8788 | 269 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8789 | 269 | tempitem.misc1 = 0; | |
| 8790 | 269 | tempitem.misc2 = 0; | |
| 8791 | 269 | tempitem.misc3 = 0; | |
| 8792 | 269 | tempitem.misc4 = 0; | |
| 8793 | 269 | tempitem.misc5 = 0; | |
| 8794 | 269 | tempitem.misc6 = 0; | |
| 8795 | 269 | tempitem.misc7 = 0; | |
| 8796 | 269 | tempitem.misc8 = 0; | |
| 8797 | 269 | tempitem.misc9 = 0; | |
| 8798 | 269 | tempitem.misc10 = 0; | |
| 8799 | 269 | tempitem.wpn = 0; | |
| 8800 | 269 | tempitem.wpn2 = 0; | |
| 8801 | 269 | tempitem.wpn3 = 0; | |
| 8802 | 269 | tempitem.wpn4 = 0; | |
| 8803 | 269 | tempitem.wpn5 = 0; | |
| 8804 | 269 | tempitem.wpn6 = 0; | |
| 8805 | 269 | tempitem.wpn7 = 0; | |
| 8806 | 269 | tempitem.wpn8 = 0; | |
| 8807 | 269 | tempitem.wpn9 = 0; | |
| 8808 | 269 | tempitem.wpn10 = 0; | |
| 8809 | 269 | break; | |
| 8810 | } | ||
| 8811 | case itype_quakescroll: | ||
| 8812 | { | ||
| 8813 | 269 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8814 | 269 | tempitem.misc3 = 0; | |
| 8815 | 269 | tempitem.misc4 = 0; | |
| 8816 | 269 | tempitem.misc5 = 0; | |
| 8817 | 269 | tempitem.misc6 = 0; | |
| 8818 | 269 | tempitem.misc7 = 0; | |
| 8819 | 269 | tempitem.misc8 = 0; | |
| 8820 | 269 | tempitem.misc9 = 0; | |
| 8821 | 269 | tempitem.misc10 = 0; | |
| 8822 | 269 | tempitem.wpn = 0; | |
| 8823 | 269 | tempitem.wpn2 = 0; | |
| 8824 | 269 | tempitem.wpn3 = 0; | |
| 8825 | 269 | tempitem.wpn4 = 0; | |
| 8826 | 269 | tempitem.wpn5 = 0; | |
| 8827 | 269 | tempitem.wpn6 = 0; | |
| 8828 | 269 | tempitem.wpn7 = 0; | |
| 8829 | 269 | tempitem.wpn8 = 0; | |
| 8830 | 269 | tempitem.wpn9 = 0; | |
| 8831 | 269 | tempitem.wpn10 = 0; | |
| 8832 | 269 | break; | |
| 8833 | } | ||
| 8834 | case itype_whispring: | ||
| 8835 | { | ||
| 8836 | 540 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8837 | 540 | tempitem.misc2 = 0; | |
| 8838 | 540 | tempitem.misc3 = 0; | |
| 8839 | 540 | tempitem.misc4 = 0; | |
| 8840 | 540 | tempitem.misc5 = 0; | |
| 8841 | 540 | tempitem.misc6 = 0; | |
| 8842 | 540 | tempitem.misc7 = 0; | |
| 8843 | 540 | tempitem.misc8 = 0; | |
| 8844 | 540 | tempitem.misc9 = 0; | |
| 8845 | 540 | tempitem.misc10 = 0; | |
| 8846 | 540 | tempitem.wpn = 0; | |
| 8847 | 540 | tempitem.wpn2 = 0; | |
| 8848 | 540 | tempitem.wpn3 = 0; | |
| 8849 | 540 | tempitem.wpn4 = 0; | |
| 8850 | 540 | tempitem.wpn5 = 0; | |
| 8851 | 540 | tempitem.wpn6 = 0; | |
| 8852 | 540 | tempitem.wpn7 = 0; | |
| 8853 | 540 | tempitem.wpn8 = 0; | |
| 8854 | 540 | tempitem.wpn9 = 0; | |
| 8855 | 540 | tempitem.wpn10 = 0; | |
| 8856 | 540 | break; | |
| 8857 | } | ||
| 8858 | case itype_chargering: | ||
| 8859 | { | ||
| 8860 | 538 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8861 | 538 | tempitem.misc3 = 0; | |
| 8862 | 538 | tempitem.misc4 = 0; | |
| 8863 | 538 | tempitem.misc5 = 0; | |
| 8864 | 538 | tempitem.misc6 = 0; | |
| 8865 | 538 | tempitem.misc7 = 0; | |
| 8866 | 538 | tempitem.misc8 = 0; | |
| 8867 | 538 | tempitem.misc9 = 0; | |
| 8868 | 538 | tempitem.misc10 = 0; | |
| 8869 | 538 | tempitem.wpn = 0; | |
| 8870 | 538 | tempitem.wpn2 = 0; | |
| 8871 | 538 | tempitem.wpn3 = 0; | |
| 8872 | 538 | tempitem.wpn4 = 0; | |
| 8873 | 538 | tempitem.wpn5 = 0; | |
| 8874 | 538 | tempitem.wpn6 = 0; | |
| 8875 | 538 | tempitem.wpn7 = 0; | |
| 8876 | 538 | tempitem.wpn8 = 0; | |
| 8877 | 538 | tempitem.wpn9 = 0; | |
| 8878 | 538 | tempitem.wpn10 = 0; | |
| 8879 | 538 | break; | |
| 8880 | } | ||
| 8881 | case itype_perilscroll: | ||
| 8882 | { | ||
| 8883 | 269 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8884 | 269 | tempitem.misc2 = 0; | |
| 8885 | 269 | tempitem.misc3 = 0; | |
| 8886 | 269 | tempitem.misc4 = 0; | |
| 8887 | 269 | tempitem.misc5 = 0; | |
| 8888 | 269 | tempitem.misc6 = 0; | |
| 8889 | 269 | tempitem.misc7 = 0; | |
| 8890 | 269 | tempitem.misc8 = 0; | |
| 8891 | 269 | tempitem.misc9 = 0; | |
| 8892 | 269 | tempitem.misc10 = 0; | |
| 8893 | 269 | tempitem.wpn = 0; | |
| 8894 | 269 | tempitem.wpn2 = 0; | |
| 8895 | 269 | tempitem.wpn3 = 0; | |
| 8896 | 269 | tempitem.wpn4 = 0; | |
| 8897 | 269 | tempitem.wpn5 = 0; | |
| 8898 | 269 | tempitem.wpn6 = 0; | |
| 8899 | 269 | tempitem.wpn7 = 0; | |
| 8900 | 269 | tempitem.wpn8 = 0; | |
| 8901 | 269 | tempitem.wpn9 = 0; | |
| 8902 | 269 | tempitem.wpn10 = 0; | |
| 8903 | 269 | break; | |
| 8904 | } | ||
| 8905 | case itype_wealthmedal: | ||
| 8906 | { | ||
| 8907 | 809 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8908 | 809 | tempitem.misc2 = 0; | |
| 8909 | 809 | tempitem.misc3 = 0; | |
| 8910 | 809 | tempitem.misc4 = 0; | |
| 8911 | 809 | tempitem.misc5 = 0; | |
| 8912 | 809 | tempitem.misc6 = 0; | |
| 8913 | 809 | tempitem.misc7 = 0; | |
| 8914 | 809 | tempitem.misc8 = 0; | |
| 8915 | 809 | tempitem.misc9 = 0; | |
| 8916 | 809 | tempitem.misc10 = 0; | |
| 8917 | 809 | tempitem.wpn = 0; | |
| 8918 | 809 | tempitem.wpn2 = 0; | |
| 8919 | 809 | tempitem.wpn3 = 0; | |
| 8920 | 809 | tempitem.wpn4 = 0; | |
| 8921 | 809 | tempitem.wpn5 = 0; | |
| 8922 | 809 | tempitem.wpn6 = 0; | |
| 8923 | 809 | tempitem.wpn7 = 0; | |
| 8924 | 809 | tempitem.wpn8 = 0; | |
| 8925 | 809 | tempitem.wpn9 = 0; | |
| 8926 | 809 | tempitem.wpn10 = 0; | |
| 8927 | 809 | break; | |
| 8928 | } | ||
| 8929 | case itype_heartring: | ||
| 8930 | { | ||
| 8931 | 811 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8932 | 811 | tempitem.misc3 = 0; | |
| 8933 | 811 | tempitem.misc4 = 0; | |
| 8934 | 811 | tempitem.misc5 = 0; | |
| 8935 | 811 | tempitem.misc6 = 0; | |
| 8936 | 811 | tempitem.misc7 = 0; | |
| 8937 | 811 | tempitem.misc8 = 0; | |
| 8938 | 811 | tempitem.misc9 = 0; | |
| 8939 | 811 | tempitem.misc10 = 0; | |
| 8940 | 811 | tempitem.wpn = 0; | |
| 8941 | 811 | tempitem.wpn2 = 0; | |
| 8942 | 811 | tempitem.wpn3 = 0; | |
| 8943 | 811 | tempitem.wpn4 = 0; | |
| 8944 | 811 | tempitem.wpn5 = 0; | |
| 8945 | 811 | tempitem.wpn6 = 0; | |
| 8946 | 811 | tempitem.wpn7 = 0; | |
| 8947 | 811 | tempitem.wpn8 = 0; | |
| 8948 | 811 | tempitem.wpn9 = 0; | |
| 8949 | 811 | tempitem.wpn10 = 0; | |
| 8950 | 811 | break; | |
| 8951 | } | ||
| 8952 | case itype_magicring: | ||
| 8953 | { | ||
| 8954 | 1084 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8955 | 1084 | tempitem.misc3 = 0; | |
| 8956 | 1084 | tempitem.misc4 = 0; | |
| 8957 | 1084 | tempitem.misc5 = 0; | |
| 8958 | 1084 | tempitem.misc6 = 0; | |
| 8959 | 1084 | tempitem.misc7 = 0; | |
| 8960 | 1084 | tempitem.misc8 = 0; | |
| 8961 | 1084 | tempitem.misc9 = 0; | |
| 8962 | 1084 | tempitem.misc10 = 0; | |
| 8963 | 1084 | tempitem.wpn = 0; | |
| 8964 | 1084 | tempitem.wpn2 = 0; | |
| 8965 | 1084 | tempitem.wpn3 = 0; | |
| 8966 | 1084 | tempitem.wpn4 = 0; | |
| 8967 | 1084 | tempitem.wpn5 = 0; | |
| 8968 | 1084 | tempitem.wpn6 = 0; | |
| 8969 | 1084 | tempitem.wpn7 = 0; | |
| 8970 | 1084 | tempitem.wpn8 = 0; | |
| 8971 | 1084 | tempitem.wpn9 = 0; | |
| 8972 | 1084 | tempitem.wpn10 = 0; | |
| 8973 | 1084 | break; | |
| 8974 | } | ||
| 8975 | case itype_spinscroll2: | ||
| 8976 | { | ||
| 8977 | 269 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8978 | 269 | tempitem.misc2 = 0; | |
| 8979 | 269 | tempitem.misc3 = 0; | |
| 8980 | 269 | tempitem.misc4 = 0; | |
| 8981 | 269 | tempitem.misc5 = 0; | |
| 8982 | 269 | tempitem.misc6 = 0; | |
| 8983 | 269 | tempitem.misc7 = 0; | |
| 8984 | 269 | tempitem.misc8 = 0; | |
| 8985 | 269 | tempitem.misc9 = 0; | |
| 8986 | 269 | tempitem.misc10 = 0; | |
| 8987 | 269 | tempitem.wpn = 0; | |
| 8988 | 269 | tempitem.wpn2 = 0; | |
| 8989 | 269 | tempitem.wpn3 = 0; | |
| 8990 | 269 | tempitem.wpn4 = 0; | |
| 8991 | 269 | tempitem.wpn5 = 0; | |
| 8992 | 269 | tempitem.wpn6 = 0; | |
| 8993 | 269 | tempitem.wpn7 = 0; | |
| 8994 | 269 | tempitem.wpn8 = 0; | |
| 8995 | 269 | tempitem.wpn9 = 0; | |
| 8996 | 269 | tempitem.wpn10 = 0; | |
| 8997 | 269 | break; | |
| 8998 | } | ||
| 8999 | case itype_quakescroll2: | ||
| 9000 | { | ||
| 9001 | 269 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 9002 | 269 | tempitem.misc3 = 0; | |
| 9003 | 269 | tempitem.misc4 = 0; | |
| 9004 | 269 | tempitem.misc5 = 0; | |
| 9005 | 269 | tempitem.misc6 = 0; | |
| 9006 | 269 | tempitem.misc7 = 0; | |
| 9007 | 269 | tempitem.misc8 = 0; | |
| 9008 | 269 | tempitem.misc9 = 0; | |
| 9009 | 269 | tempitem.misc10 = 0; | |
| 9010 | 269 | tempitem.wpn = 0; | |
| 9011 | 269 | tempitem.wpn2 = 0; | |
| 9012 | 269 | tempitem.wpn3 = 0; | |
| 9013 | 269 | tempitem.wpn4 = 0; | |
| 9014 | 269 | tempitem.wpn5 = 0; | |
| 9015 | 269 | tempitem.wpn6 = 0; | |
| 9016 | 269 | tempitem.wpn7 = 0; | |
| 9017 | 269 | tempitem.wpn8 = 0; | |
| 9018 | 269 | tempitem.wpn9 = 0; | |
| 9019 | 269 | tempitem.wpn10 = 0; | |
| 9020 | 269 | break; | |
| 9021 | } | ||
| 9022 | case itype_agony: | ||
| 9023 | { | ||
| 9024 | 269 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 9025 | 269 | tempitem.misc2 = 0; | |
| 9026 | 269 | tempitem.misc3 = 0; | |
| 9027 | 269 | tempitem.misc4 = 0; | |
| 9028 | 269 | tempitem.misc5 = 0; | |
| 9029 | 269 | tempitem.misc6 = 0; | |
| 9030 | 269 | tempitem.misc7 = 0; | |
| 9031 | 269 | tempitem.misc8 = 0; | |
| 9032 | 269 | tempitem.misc9 = 0; | |
| 9033 | 269 | tempitem.misc10 = 0; | |
| 9034 | 269 | tempitem.wpn = 0; | |
| 9035 | 269 | tempitem.wpn2 = 0; | |
| 9036 | 269 | tempitem.wpn3 = 0; | |
| 9037 | 269 | tempitem.wpn4 = 0; | |
| 9038 | 269 | tempitem.wpn5 = 0; | |
| 9039 | 269 | tempitem.wpn6 = 0; | |
| 9040 | 269 | tempitem.wpn7 = 0; | |
| 9041 | 269 | tempitem.wpn8 = 0; | |
| 9042 | 269 | tempitem.wpn9 = 0; | |
| 9043 | 269 | tempitem.wpn10 = 0; | |
| 9044 | 269 | break; | |
| 9045 | } | ||
| 9046 | case itype_stompboots: | ||
| 9047 | { | ||
| 9048 | 269 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 9049 | 269 | tempitem.misc1 = 0; | |
| 9050 | 269 | tempitem.misc2 = 0; | |
| 9051 | 269 | tempitem.misc3 = 0; | |
| 9052 | 269 | tempitem.misc4 = 0; | |
| 9053 | 269 | tempitem.misc5 = 0; | |
| 9054 | 269 | tempitem.misc6 = 0; | |
| 9055 | 269 | tempitem.misc7 = 0; | |
| 9056 | 269 | tempitem.misc8 = 0; | |
| 9057 | 269 | tempitem.misc9 = 0; | |
| 9058 | 269 | tempitem.misc10 = 0; | |
| 9059 | 269 | tempitem.wpn = 0; | |
| 9060 | 269 | tempitem.wpn2 = 0; | |
| 9061 | 269 | tempitem.wpn3 = 0; | |
| 9062 | 269 | tempitem.wpn4 = 0; | |
| 9063 | 269 | tempitem.wpn5 = 0; | |
| 9064 | 269 | tempitem.wpn6 = 0; | |
| 9065 | 269 | tempitem.wpn7 = 0; | |
| 9066 | 269 | tempitem.wpn8 = 0; | |
| 9067 | 269 | tempitem.wpn9 = 0; | |
| 9068 | 269 | tempitem.wpn10 = 0; | |
| 9069 | 269 | break; | |
| 9070 | } | ||
| 9071 | case itype_whimsicalring: | ||
| 9072 | { | ||
| 9073 | 269 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 9074 | 269 | tempitem.misc2 = 0; | |
| 9075 | 269 | tempitem.misc3 = 0; | |
| 9076 | 269 | tempitem.misc4 = 0; | |
| 9077 | 269 | tempitem.misc5 = 0; | |
| 9078 | 269 | tempitem.misc6 = 0; | |
| 9079 | 269 | tempitem.misc7 = 0; | |
| 9080 | 269 | tempitem.misc8 = 0; | |
| 9081 | 269 | tempitem.misc9 = 0; | |
| 9082 | 269 | tempitem.misc10 = 0; | |
| 9083 | 269 | tempitem.wpn = 0; | |
| 9084 | 269 | tempitem.wpn2 = 0; | |
| 9085 | 269 | tempitem.wpn3 = 0; | |
| 9086 | 269 | tempitem.wpn4 = 0; | |
| 9087 | 269 | tempitem.wpn5 = 0; | |
| 9088 | 269 | tempitem.wpn6 = 0; | |
| 9089 | 269 | tempitem.wpn7 = 0; | |
| 9090 | 269 | tempitem.wpn8 = 0; | |
| 9091 | 269 | tempitem.wpn9 = 0; | |
| 9092 | 269 | tempitem.wpn10 = 0; | |
| 9093 | 269 | break; | |
| 9094 | } | ||
| 9095 | case itype_perilring: | ||
| 9096 | { | ||
| 9097 | 295 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 9098 | 295 | tempitem.misc2 = 0; | |
| 9099 | 295 | tempitem.misc3 = 0; | |
| 9100 | 295 | tempitem.misc4 = 0; | |
| 9101 | 295 | tempitem.misc5 = 0; | |
| 9102 | 295 | tempitem.misc6 = 0; | |
| 9103 | 295 | tempitem.misc7 = 0; | |
| 9104 | 295 | tempitem.misc8 = 0; | |
| 9105 | 295 | tempitem.misc9 = 0; | |
| 9106 | 295 | tempitem.misc10 = 0; | |
| 9107 | 295 | tempitem.wpn = 0; | |
| 9108 | 295 | tempitem.wpn2 = 0; | |
| 9109 | 295 | tempitem.wpn3 = 0; | |
| 9110 | 295 | tempitem.wpn4 = 0; | |
| 9111 | 295 | tempitem.wpn5 = 0; | |
| 9112 | 295 | tempitem.wpn6 = 0; | |
| 9113 | 295 | tempitem.wpn7 = 0; | |
| 9114 | 295 | tempitem.wpn8 = 0; | |
| 9115 | 295 | tempitem.wpn9 = 0; | |
| 9116 | 295 | tempitem.wpn10 = 0; | |
| 9117 | 295 | break; | |
| 9118 | } | ||
| 9119 | case itype_custom1: case itype_custom2: case itype_custom3: case itype_custom4: case itype_custom5: | ||
| 9120 | case itype_custom6: case itype_custom7: case itype_custom8: case itype_custom9: case itype_custom10: | ||
| 9121 | case itype_custom11: case itype_custom12: case itype_custom13: case itype_custom14: case itype_custom15: | ||
| 9122 | case itype_custom16: case itype_custom17: case itype_custom18: case itype_custom19: case itype_custom20: | ||
| 9123 | case itype_bowandarrow: case itype_letterpotion: case itype_misc: | ||
| 9124 | { | ||
| 9125 | 9413 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 9126 | 9413 | tempitem.misc1 = 0; | |
| 9127 | 9413 | tempitem.misc2 = 0; | |
| 9128 | 9413 | tempitem.misc3 = 0; | |
| 9129 | 9413 | tempitem.misc4 = 0; | |
| 9130 | 9413 | tempitem.misc5 = 0; | |
| 9131 | 9413 | tempitem.misc6 = 0; | |
| 9132 | 9413 | tempitem.misc7 = 0; | |
| 9133 | 9413 | tempitem.misc8 = 0; | |
| 9134 | 9413 | tempitem.misc9 = 0; | |
| 9135 | 9413 | tempitem.misc10 = 0; | |
| 9136 | 9413 | tempitem.wpn = 0; | |
| 9137 | 9413 | tempitem.wpn2 = 0; | |
| 9138 | 9413 | tempitem.wpn3 = 0; | |
| 9139 | 9413 | tempitem.wpn4 = 0; | |
| 9140 | 9413 | tempitem.wpn5 = 0; | |
| 9141 | 9413 | tempitem.wpn6 = 0; | |
| 9142 | 9413 | tempitem.wpn7 = 0; | |
| 9143 | 9413 | tempitem.wpn8 = 0; | |
| 9144 | 9413 | tempitem.wpn9 = 0; | |
| 9145 | 9413 | tempitem.wpn10 = 0; | |
| 9146 | 9413 | break; | |
| 9147 | } | ||
| 9148 | } | ||
| 9149 | 69376 | } | |
| 9150 | //Port quest rules to items | ||
| 9151 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 69376 times.
|
105984 | if( s_version <= 31) |
| 9152 | { | ||
| 9153 |
2/2✓ Branch 0 taken 285 times.
✓ Branch 1 taken 69091 times.
|
69376 | if(tempitem.family == itype_bomb) |
| 9154 | { | ||
| 9155 |
2/2✓ Branch 0 taken 155 times.
✓ Branch 1 taken 130 times.
|
285 | if ( get_qr(qr_OUCHBOMBS) ) tempitem.flags |= item_flag2; |
| 9156 | 130 | else tempitem.flags &= ~ item_flag2; | |
| 9157 | 285 | } | |
| 9158 |
2/2✓ Branch 0 taken 271 times.
✓ Branch 1 taken 68820 times.
|
69091 | else if(tempitem.family == itype_sbomb) |
| 9159 | { | ||
| 9160 |
2/2✓ Branch 0 taken 157 times.
✓ Branch 1 taken 114 times.
|
271 | if ( get_qr(qr_OUCHBOMBS) ) tempitem.flags |= item_flag2; |
| 9161 | 114 | else tempitem.flags &= ~ item_flag2; | |
| 9162 | 271 | } | |
| 9163 | |||
| 9164 |
2/2✓ Branch 0 taken 813 times.
✓ Branch 1 taken 68007 times.
|
68820 | else if(tempitem.family == itype_brang) |
| 9165 | { | ||
| 9166 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 813 times.
|
813 | if ( get_qr(qr_BRANGPICKUP) ) tempitem.flags |= item_flag4; |
| 9167 | 813 | else tempitem.flags &= ~ item_flag4; | |
| 9168 | 813 | } | |
| 9169 |
2/2✓ Branch 0 taken 67720 times.
✓ Branch 1 taken 287 times.
|
68007 | else if(tempitem.family == itype_wand) |
| 9170 | { | ||
| 9171 |
2/2✓ Branch 0 taken 19 times.
✓ Branch 1 taken 268 times.
|
287 | if ( get_qr(qr_NOWANDMELEE) ) tempitem.flags |= item_flag3; |
| 9172 | 268 | else tempitem.flags &= ~ item_flag3; | |
| 9173 | 287 | } | |
| 9174 | 69376 | } | |
| 9175 | |||
| 9176 | //Port quest rules to items | ||
| 9177 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 69376 times.
|
105984 | if( s_version <= 37) |
| 9178 | { | ||
| 9179 |
2/2✓ Branch 0 taken 271 times.
✓ Branch 1 taken 69105 times.
|
69376 | if(tempitem.family == itype_flippers) |
| 9180 | { | ||
| 9181 |
2/2✓ Branch 0 taken 78 times.
✓ Branch 1 taken 193 times.
|
271 | if ( (get_qr(qr_NODIVING)) ) tempitem.flags |= item_flag1; |
| 9182 | 193 | else tempitem.flags &= ~ item_flag1; | |
| 9183 | 271 | } | |
| 9184 |
2/2✓ Branch 0 taken 51590 times.
✓ Branch 1 taken 17515 times.
|
69105 | else if(tempitem.family == itype_sword) |
| 9185 | { | ||
| 9186 |
2/2✓ Branch 0 taken 462 times.
✓ Branch 1 taken 17053 times.
|
17515 | if ( (get_qr(qr_QUICKSWORD)) ) tempitem.flags |= item_flag5; |
| 9187 | 17053 | else tempitem.flags &= ~ item_flag5; | |
| 9188 | 17515 | } | |
| 9189 |
2/2✓ Branch 0 taken 287 times.
✓ Branch 1 taken 51303 times.
|
51590 | else if(tempitem.family == itype_wand) |
| 9190 | { | ||
| 9191 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 277 times.
|
287 | if ( (get_qr(qr_QUICKSWORD)) ) tempitem.flags |= item_flag5; |
| 9192 | 277 | else tempitem.flags &= ~ item_flag5; | |
| 9193 | 287 | } | |
| 9194 |
4/4✓ Branch 0 taken 51018 times.
✓ Branch 1 taken 285 times.
✓ Branch 2 taken 580 times.
✓ Branch 3 taken 50438 times.
|
51303 | else if(tempitem.family == itype_book || tempitem.family == itype_candle) |
| 9195 | { | ||
| 9196 | //@Emily: What was qrFIREPROOFHERO2 again, and does that also need to enable this? | ||
| 9197 |
2/2✓ Branch 0 taken 375 times.
✓ Branch 1 taken 490 times.
|
865 | if ( (get_qr(qr_FIREPROOFHERO)) ) tempitem.flags |= item_flag3; |
| 9198 | 490 | else tempitem.flags &= ~ item_flag3; | |
| 9199 | 865 | } | |
| 9200 | 69376 | } | |
| 9201 | |||
| 9202 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 69376 times.
|
105984 | if( s_version < 38) |
| 9203 | { | ||
| 9204 |
4/4✓ Branch 0 taken 68563 times.
✓ Branch 1 taken 813 times.
✓ Branch 2 taken 540 times.
✓ Branch 3 taken 68023 times.
|
69376 | if(tempitem.family == itype_brang || tempitem.family == itype_hookshot) |
| 9205 | { | ||
| 9206 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1353 times.
|
1353 | if(get_qr(qr_BRANGPICKUP)) tempitem.flags |= item_flag4; |
| 9207 | 1353 | else tempitem.flags &= ~item_flag4; | |
| 9208 | |||
| 9209 |
2/2✓ Branch 0 taken 672 times.
✓ Branch 1 taken 681 times.
|
1353 | if(get_qr(qr_Z3BRANG_HSHOT)) tempitem.flags |= item_flag5 | item_flag6; |
| 9210 | 681 | else tempitem.flags &= ~(item_flag5|item_flag6); | |
| 9211 | 1353 | } | |
| 9212 |
2/2✓ Branch 0 taken 67222 times.
✓ Branch 1 taken 801 times.
|
68023 | else if(tempitem.family == itype_arrow) |
| 9213 | { | ||
| 9214 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 801 times.
|
801 | if(get_qr(qr_BRANGPICKUP)) tempitem.flags |= item_flag4; |
| 9215 | 801 | else tempitem.flags &= ~item_flag4; | |
| 9216 | |||
| 9217 |
2/2✓ Branch 0 taken 396 times.
✓ Branch 1 taken 405 times.
|
801 | if(get_qr(qr_Z3BRANG_HSHOT)) tempitem.flags &= ~item_flag2; |
| 9218 | 405 | else tempitem.flags |= item_flag2; | |
| 9219 | 801 | } | |
| 9220 | 69376 | } | |
| 9221 | |||
| 9222 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 69376 times.
|
105984 | if( s_version < 39) |
| 9223 | { | ||
| 9224 |
6/6✓ Branch 0 taken 69107 times.
✓ Branch 1 taken 269 times.
✓ Branch 2 taken 68822 times.
✓ Branch 3 taken 285 times.
✓ Branch 4 taken 580 times.
✓ Branch 5 taken 68242 times.
|
69376 | if(tempitem.family == itype_divinefire || tempitem.family == itype_book || tempitem.family == itype_candle) |
| 9225 | { | ||
| 9226 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 1118 times.
|
1134 | if(get_qr(qr_TEMPCANDLELIGHT)) tempitem.flags |= item_flag5; |
| 9227 | 1118 | else tempitem.flags &= ~item_flag5; | |
| 9228 | 1134 | } | |
| 9229 |
2/2✓ Branch 0 taken 593 times.
✓ Branch 1 taken 67649 times.
|
68242 | else if(tempitem.family == itype_potion) |
| 9230 | { | ||
| 9231 |
2/2✓ Branch 0 taken 162 times.
✓ Branch 1 taken 431 times.
|
593 | if(get_qr(qr_NONBUBBLEMEDICINE)) |
| 9232 | { | ||
| 9233 | 162 | tempitem.flags &= ~(item_flag3|item_flag4); | |
| 9234 | 162 | } | |
| 9235 | else | ||
| 9236 | { | ||
| 9237 | 431 | tempitem.flags |= item_flag3; | |
| 9238 |
2/2✓ Branch 0 taken 121 times.
✓ Branch 1 taken 310 times.
|
431 | if(get_qr(qr_ITEMBUBBLE))tempitem.flags |= item_flag4; |
| 9239 | 310 | else tempitem.flags &= ~item_flag4; | |
| 9240 | } | ||
| 9241 | 593 | } | |
| 9242 |
2/2✓ Branch 0 taken 67111 times.
✓ Branch 1 taken 538 times.
|
67649 | else if(tempitem.family == itype_triforcepiece) |
| 9243 | { | ||
| 9244 |
2/2✓ Branch 0 taken 84 times.
✓ Branch 1 taken 454 times.
|
538 | if(get_qr(qr_NONBUBBLETRIFORCE)) |
| 9245 | { | ||
| 9246 | 84 | tempitem.flags |= item_flag3; | |
| 9247 |
2/2✓ Branch 0 taken 56 times.
✓ Branch 1 taken 28 times.
|
84 | if(get_qr(qr_ITEMBUBBLE))tempitem.flags |= item_flag4; |
| 9248 | 28 | else tempitem.flags &= ~item_flag4; | |
| 9249 | 84 | } | |
| 9250 | else | ||
| 9251 | { | ||
| 9252 | 454 | tempitem.flags &= ~(item_flag3|item_flag4); | |
| 9253 | } | ||
| 9254 | 538 | } | |
| 9255 | 69376 | } | |
| 9256 | |||
| 9257 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 69376 times.
|
105984 | if( s_version < 40) |
| 9258 | { | ||
| 9259 |
4/4✓ Branch 0 taken 68515 times.
✓ Branch 1 taken 861 times.
✓ Branch 2 taken 295 times.
✓ Branch 3 taken 68220 times.
|
69376 | if(tempitem.family == itype_ring || tempitem.family == itype_perilring) |
| 9260 | { | ||
| 9261 |
2/2✓ Branch 0 taken 266 times.
✓ Branch 1 taken 890 times.
|
1156 | if(get_qr(qr_RINGAFFECTDAMAGE))tempitem.flags |= item_flag1; |
| 9262 | 890 | else tempitem.flags &= ~item_flag1; | |
| 9263 | 1156 | } | |
| 9264 |
8/8✓ Branch 0 taken 67640 times.
✓ Branch 1 taken 580 times.
✓ Branch 2 taken 50125 times.
✓ Branch 3 taken 17515 times.
✓ Branch 4 taken 49838 times.
✓ Branch 5 taken 287 times.
✓ Branch 6 taken 269 times.
✓ Branch 7 taken 49569 times.
|
68220 | else if(tempitem.family == itype_candle || tempitem.family == itype_sword || tempitem.family == itype_wand || tempitem.family == itype_cbyrna) |
| 9265 | { | ||
| 9266 |
2/2✓ Branch 0 taken 108 times.
✓ Branch 1 taken 18543 times.
|
18651 | if(get_qr(qr_SLASHFLIPFIX))tempitem.flags |= item_flag8; |
| 9267 | 18543 | else tempitem.flags &= ~item_flag8; | |
| 9268 | 18651 | } | |
| 9269 |
6/6✓ Branch 0 taken 51861 times.
✓ Branch 1 taken 17515 times.
✓ Branch 2 taken 51574 times.
✓ Branch 3 taken 287 times.
✓ Branch 4 taken 271 times.
✓ Branch 5 taken 51303 times.
|
69376 | if(tempitem.family == itype_sword || tempitem.family == itype_wand || tempitem.family == itype_hammer) |
| 9270 | { | ||
| 9271 |
2/2✓ Branch 0 taken 104 times.
✓ Branch 1 taken 17969 times.
|
18073 | if(get_qr(qr_NOITEMMELEE))tempitem.flags |= item_flag7; |
| 9272 | 17969 | else tempitem.flags &= ~item_flag7; | |
| 9273 | 18073 | } | |
| 9274 |
2/2✓ Branch 0 taken 51034 times.
✓ Branch 1 taken 269 times.
|
51303 | else if(tempitem.family == itype_cbyrna) |
| 9275 | { | ||
| 9276 | 269 | tempitem.flags |= item_flag7; | |
| 9277 | 269 | } | |
| 9278 | 69376 | } | |
| 9279 | |||
| 9280 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 69376 times.
|
105984 | if( s_version < 41 ) |
| 9281 | { | ||
| 9282 |
2/2✓ Branch 0 taken 51861 times.
✓ Branch 1 taken 17515 times.
|
69376 | if(tempitem.family == itype_sword) |
| 9283 | { | ||
| 9284 |
2/2✓ Branch 0 taken 188 times.
✓ Branch 1 taken 17327 times.
|
17515 | if(get_qr(qr_SWORDMIRROR))tempitem.flags |= item_flag9; |
| 9285 | 17327 | else tempitem.flags &= ~item_flag9; | |
| 9286 | |||
| 9287 |
2/2✓ Branch 0 taken 428 times.
✓ Branch 1 taken 17087 times.
|
17515 | if(get_qr(qr_SLOWCHARGINGWALK))tempitem.flags |= item_flag10; |
| 9288 | 17087 | else tempitem.flags &= ~item_flag10; | |
| 9289 | 17515 | } | |
| 9290 | 69376 | } | |
| 9291 | |||
| 9292 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 69376 times.
|
105984 | if( s_version < 42 ) |
| 9293 | { | ||
| 9294 |
2/2✓ Branch 0 taken 287 times.
✓ Branch 1 taken 69089 times.
|
69376 | if(tempitem.family == itype_wand) |
| 9295 | { | ||
| 9296 |
2/2✓ Branch 0 taken 19 times.
✓ Branch 1 taken 268 times.
|
287 | if(get_qr(qr_NOWANDMELEE))tempitem.flags |= item_flag3; |
| 9297 | 268 | else tempitem.flags &= ~item_flag3; | |
| 9298 | |||
| 9299 | 287 | tempitem.flags &= ~item_flag6; | |
| 9300 | 287 | } | |
| 9301 |
2/2✓ Branch 0 taken 271 times.
✓ Branch 1 taken 68818 times.
|
69089 | else if(tempitem.family == itype_hammer) |
| 9302 | { | ||
| 9303 | 271 | tempitem.flags &= ~item_flag3; | |
| 9304 | 271 | } | |
| 9305 |
2/2✓ Branch 0 taken 269 times.
✓ Branch 1 taken 68549 times.
|
68818 | else if(tempitem.family == itype_cbyrna) |
| 9306 | { | ||
| 9307 | 269 | tempitem.flags |= item_flag3; | |
| 9308 | |||
| 9309 | 269 | tempitem.flags &= ~item_flag6; | |
| 9310 | 269 | } | |
| 9311 |
2/2✓ Branch 0 taken 51034 times.
✓ Branch 1 taken 17515 times.
|
68549 | else if(tempitem.family == itype_sword) |
| 9312 | { | ||
| 9313 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17515 times.
|
17515 | if(get_qr(qr_MELEEMAGICCOST))tempitem.flags |= item_flag6; |
| 9314 | 17515 | else tempitem.flags &= ~item_flag6; | |
| 9315 | 17515 | } | |
| 9316 | 69376 | } | |
| 9317 | |||
| 9318 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 69376 times.
|
105984 | if( s_version < 43 ) |
| 9319 | { | ||
| 9320 |
2/2✓ Branch 0 taken 69059 times.
✓ Branch 1 taken 317 times.
|
69376 | if(tempitem.family == itype_whistle) |
| 9321 | { | ||
| 9322 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 309 times.
|
317 | if(get_qr(qr_WHIRLWINDMIRROR))tempitem.flags |= item_flag3; |
| 9323 | 309 | else tempitem.flags &= ~item_flag3; | |
| 9324 | 317 | } | |
| 9325 | 69376 | } | |
| 9326 | |||
| 9327 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 69376 times.
|
105984 | if( s_version < 45 ) |
| 9328 | { | ||
| 9329 |
2/2✓ Branch 0 taken 69105 times.
✓ Branch 1 taken 271 times.
|
69376 | if(tempitem.family == itype_flippers) |
| 9330 | { | ||
| 9331 | 271 | tempitem.misc1 = 50; //Dive length, default 50 frames -V | |
| 9332 | 271 | tempitem.misc2 = 30; //Dive cooldown, default 30 frames -V | |
| 9333 | 271 | } | |
| 9334 | 69376 | } | |
| 9335 | |||
| 9336 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 69376 times.
|
105984 | if( s_version < 46 ) |
| 9337 | { | ||
| 9338 |
2/2✓ Branch 0 taken 69107 times.
✓ Branch 1 taken 269 times.
|
69376 | if(tempitem.family == itype_raft) |
| 9339 | { | ||
| 9340 | 269 | tempitem.misc1 = 1; //Rafting speed modifier; default 1. Negative slows, positive speeds. | |
| 9341 | 269 | } | |
| 9342 | 69376 | } | |
| 9343 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 69376 times.
|
105984 | if ( s_version < 34 ) //! set the default counter for older quests. |
| 9344 | { | ||
| 9345 |
2/2✓ Branch 0 taken 106 times.
✓ Branch 1 taken 69270 times.
|
69376 | if ( (tempitem.flags & item_rupee_magic) ) |
| 9346 | { | ||
| 9347 | 106 | tempitem.cost_counter[0] = 1; | |
| 9348 | 106 | } | |
| 9349 | else | ||
| 9350 | { | ||
| 9351 |
2/2✓ Branch 0 taken 42240 times.
✓ Branch 1 taken 27030 times.
|
69270 | if(get_qr(qr_ENABLEMAGIC)) |
| 9352 | 42240 | tempitem.cost_counter[0] = 4; | |
| 9353 | else | ||
| 9354 | { | ||
| 9355 | 27030 | tempitem.cost_amount[0] = 0; | |
| 9356 | 27030 | tempitem.cost_counter[0] = -1; | |
| 9357 | } | ||
| 9358 | } | ||
| 9359 | 69376 | } | |
| 9360 | |||
| 9361 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 69376 times.
|
105984 | if ( s_version < 35 ) //new Lens of Truth flags |
| 9362 | { | ||
| 9363 |
2/2✓ Branch 0 taken 69131 times.
✓ Branch 1 taken 245 times.
|
69376 | if ( tempitem.family == itype_lens ) |
| 9364 | { | ||
| 9365 |
2/2✓ Branch 0 taken 237 times.
✓ Branch 1 taken 8 times.
|
245 | if ( get_qr(qr_RAFTLENS) ) |
| 9366 | { | ||
| 9367 | 8 | tempitem.flags |= item_flag4; | |
| 9368 | 8 | } | |
| 9369 |
2/2✓ Branch 0 taken 79 times.
✓ Branch 1 taken 166 times.
|
245 | if ( get_qr(qr_LENSHINTS) ) |
| 9370 | { | ||
| 9371 | 166 | tempitem.flags |= item_flag1; | |
| 9372 | 166 | } | |
| 9373 |
2/2✓ Branch 0 taken 234 times.
✓ Branch 1 taken 11 times.
|
245 | if ( get_qr(qr_LENSSEESENEMIES) ) |
| 9374 | { | ||
| 9375 | 11 | tempitem.flags |= item_flag5; | |
| 9376 | 11 | } | |
| 9377 | 245 | } | |
| 9378 | 69376 | } | |
| 9379 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 69376 times.
|
105984 | if ( s_version < 44 ) //InitD Labels and Sprite Script Data |
| 9380 | { | ||
| 9381 |
2/2✓ Branch 0 taken 555008 times.
✓ Branch 1 taken 69376 times.
|
624384 | for ( int32_t q = 0; q < 8; q++ ) |
| 9382 | { | ||
| 9383 | 555008 | sprintf(tempitem.initD_label[q],"InitD[%d]",q); | |
| 9384 | 555008 | sprintf(tempitem.weapon_initD_label[q],"InitD[%d]",q); | |
| 9385 | 555008 | sprintf(tempitem.sprite_initD_label[q],"InitD[%d]",q); | |
| 9386 | 555008 | tempitem.sprite_initiald[q] = 0; | |
| 9387 | 555008 | } | |
| 9388 |
2/2✓ Branch 0 taken 138752 times.
✓ Branch 1 taken 69376 times.
|
208128 | for ( int32_t q = 0; q < 2; q++ ) tempitem.sprite_initiala[q] = 0; |
| 9389 | 69376 | tempitem.sprite_script = 0; | |
| 9390 | 69376 | } | |
| 9391 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 69376 times.
|
105984 | if ( s_version < 47 ) //InitD Labels and Sprite Script Data |
| 9392 | { | ||
| 9393 | 69376 | tempitem.pickupflag = 0; | |
| 9394 | 69376 | } | |
| 9395 | |||
| 9396 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 69376 times.
|
105984 | if( s_version < 51 ) |
| 9397 | { | ||
| 9398 |
2/2✓ Branch 0 taken 68796 times.
✓ Branch 1 taken 580 times.
|
69376 | if( tempitem.family == itype_candle ) |
| 9399 | { | ||
| 9400 | 580 | tempitem.misc4 = 50; //Step speed | |
| 9401 | 580 | } | |
| 9402 | 69376 | } | |
| 9403 | |||
| 9404 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 69376 times.
|
105984 | if( s_version < 52 ) |
| 9405 | { | ||
| 9406 |
2/2✓ Branch 0 taken 68555 times.
✓ Branch 1 taken 821 times.
|
69376 | if( tempitem.family == itype_shield ) |
| 9407 | 821 | tempitem.flags |= item_flag1; //'Block Front' flag | |
| 9408 | 69376 | } | |
| 9409 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 69376 times.
|
105984 | if(s_version < 53) |
| 9410 | { | ||
| 9411 |
4/4✓ Branch 0 taken 68019 times.
✓ Branch 1 taken 801 times.
✓ Branch 2 taken 285 times.
✓ Branch 3 taken 271 times.
|
69376 | switch(tempitem.family) |
| 9412 | { | ||
| 9413 | case itype_arrow: | ||
| 9414 | 801 | tempitem.cost_counter[1] = crARROWS; | |
| 9415 | 801 | tempitem.cost_amount[1] = 1; | |
| 9416 | 801 | break; | |
| 9417 | case itype_bomb: | ||
| 9418 | 285 | tempitem.cost_counter[1] = crBOMBS; | |
| 9419 | 285 | tempitem.cost_amount[1] = 1; | |
| 9420 | 285 | break; | |
| 9421 | case itype_sbomb: | ||
| 9422 | 271 | tempitem.cost_counter[1] = crSBOMBS; | |
| 9423 | 271 | tempitem.cost_amount[1] = 1; | |
| 9424 | 271 | break; | |
| 9425 | default: | ||
| 9426 | 68019 | tempitem.cost_counter[1] = crNONE; | |
| 9427 | 68019 | tempitem.cost_amount[1] = 0; | |
| 9428 | 68019 | } | |
| 9429 | 69376 | tempitem.magiccosttimer[1] = 0; | |
| 9430 | 69376 | } | |
| 9431 |
2/2✓ Branch 0 taken 33792 times.
✓ Branch 1 taken 72192 times.
|
105984 | if( s_version < 54 ) |
| 9432 | { | ||
| 9433 |
2/2✓ Branch 0 taken 71908 times.
✓ Branch 1 taken 284 times.
|
72192 | if( tempitem.family == itype_flippers ) |
| 9434 | 284 | tempitem.misc3 = INT_BTN_A; //'Block Front' flag | |
| 9435 | 72192 | } | |
| 9436 |
2/2✓ Branch 0 taken 33792 times.
✓ Branch 1 taken 72192 times.
|
105984 | if(s_version < 55) |
| 9437 | { | ||
| 9438 |
3/3✓ Branch 0 taken 560 times.
✓ Branch 1 taken 560 times.
✓ Branch 2 taken 71072 times.
|
72192 | switch(tempitem.family) |
| 9439 | { | ||
| 9440 | case itype_spinscroll: | ||
| 9441 | case itype_quakescroll: | ||
| 9442 | 560 | tempitem.usesound2 = WAV_ZN1CHARGE; | |
| 9443 | 560 | break; | |
| 9444 | case itype_spinscroll2: | ||
| 9445 | case itype_quakescroll2: | ||
| 9446 | 560 | tempitem.usesound2 = WAV_ZN1CHARGE2; | |
| 9447 | 560 | break; | |
| 9448 | } | ||
| 9449 | 72192 | } | |
| 9450 |
2/2✓ Branch 0 taken 33792 times.
✓ Branch 1 taken 72192 times.
|
105984 | if(s_version < 56) |
| 9451 | { | ||
| 9452 |
4/4✓ Branch 0 taken 71010 times.
✓ Branch 1 taken 280 times.
✓ Branch 2 taken 606 times.
✓ Branch 3 taken 296 times.
|
72192 | switch(tempitem.family) |
| 9453 | { | ||
| 9454 | case itype_divinefire: | ||
| 9455 |
2/2✓ Branch 0 taken 269 times.
✓ Branch 1 taken 11 times.
|
280 | SETFLAG(tempitem.flags, item_flag9, version < 0x255); //Strong Fire |
| 9456 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 198 times.
|
280 | SETFLAG(tempitem.flags, item_flag10, version < 0x250); //Magic Fire |
| 9457 | 280 | tempitem.flags |= item_flag11; //Divine Fire | |
| 9458 | 280 | break; | |
| 9459 | case itype_candle: | ||
| 9460 |
2/2✓ Branch 0 taken 302 times.
✓ Branch 1 taken 304 times.
|
606 | SETFLAG(tempitem.flags, item_flag9, tempitem.fam_type > 1); //Strong Fire |
| 9461 | 606 | tempitem.flags &= ~item_flag10; //Magic Fire | |
| 9462 | 606 | tempitem.flags &= ~item_flag11; //Divine Fire | |
| 9463 | 606 | break; | |
| 9464 | case itype_book: | ||
| 9465 | 296 | tempitem.flags |= item_flag9; //Strong Fire | |
| 9466 | 296 | tempitem.flags |= item_flag10; //Magic Fire | |
| 9467 | 296 | tempitem.flags &= ~item_flag11; //Divine Fire | |
| 9468 | 296 | break; | |
| 9469 | } | ||
| 9470 | 72192 | } | |
| 9471 | |||
| 9472 |
2/2✓ Branch 0 taken 94996 times.
✓ Branch 1 taken 10988 times.
|
105984 | if(tempitem.fam_type==0) // Always do this |
| 9473 | 10988 | tempitem.fam_type=1; | |
| 9474 | |||
| 9475 | 105984 | memcpy(&itemsbuf[i], &tempitem, sizeof(itemdata)); | |
| 9476 | 105984 | } | |
| 9477 | |||
| 9478 | 414 | return 0; | |
| 9479 | 415 | } | |
| 9480 | |||
| 9481 | static bool did_init_def_items = false; | ||
| 9482 | 211834 | void init_def_items() | |
| 9483 | { | ||
| 9484 |
2/2✓ Branch 0 taken 211520 times.
✓ Branch 1 taken 314 times.
|
211834 | if(did_init_def_items) return; |
| 9485 | 314 | did_init_def_items = true; | |
| 9486 | 314 | default_items[3].cost_counter[1] = crBOMBS; | |
| 9487 | 314 | default_items[13].cost_counter[1] = crARROWS; | |
| 9488 | 314 | default_items[14].cost_counter[1] = crARROWS; | |
| 9489 | 314 | default_items[48].cost_counter[1] = crSBOMBS; | |
| 9490 | 314 | default_items[57].cost_counter[1] = crARROWS; | |
| 9491 | 211834 | } | |
| 9492 | 211834 | void reset_itembuf(itemdata *item, int32_t id) | |
| 9493 | { | ||
| 9494 | 211834 | init_def_items(); | |
| 9495 |
2/2✓ Branch 0 taken 88253 times.
✓ Branch 1 taken 123581 times.
|
211834 | if(id<iLast) |
| 9496 | { | ||
| 9497 | // Copy everything *EXCEPT* the tile, misc, cset, frames, speed, delay and ltm. | ||
| 9498 | 123581 | word tile = item->tile; | |
| 9499 | 123581 | byte miscs = item->misc_flags, cset = item->csets, frames = item->frames, speed = item->speed, delay = item->delay; | |
| 9500 | 123581 | int32_t ltm = item->ltm; | |
| 9501 | |||
| 9502 | 123581 | memcpy(item,&default_items[id],sizeof(itemdata)); | |
| 9503 | 123581 | item->tile = tile; | |
| 9504 | 123581 | item->misc_flags = miscs; | |
| 9505 | 123581 | item->csets = cset; | |
| 9506 | 123581 | item->frames = frames; | |
| 9507 | 123581 | item->speed = speed; | |
| 9508 | 123581 | item->delay = delay; | |
| 9509 | 123581 | item->ltm = ltm; | |
| 9510 | 123581 | } | |
| 9511 | 211834 | } | |
| 9512 | |||
| 9513 | 89344 | void reset_itemname(int32_t id) | |
| 9514 | { | ||
| 9515 | 89344 | sprintf(item_string[id],"zz%03d",id); | |
| 9516 | |||
| 9517 |
2/2✓ Branch 0 taken 39437 times.
✓ Branch 1 taken 49907 times.
|
89344 | if(id < iLast) |
| 9518 | 49907 | strcpy(item_string[id],old_item_string[id]); | |
| 9519 | 89344 | } | |
| 9520 | |||
| 9521 | 415 | int32_t readweapons(PACKFILE *f, zquestheader *Header) | |
| 9522 | { | ||
| 9523 |
2/2✓ Branch 0 taken 391 times.
✓ Branch 1 taken 24 times.
|
415 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_weapons); |
| 9524 | |||
| 9525 | 415 | word weapons_to_read=MAXWPNS; | |
| 9526 | int32_t dummy; | ||
| 9527 | byte padding; | ||
| 9528 | wpndata tempweapon; | ||
| 9529 | 415 | word s_version=0, s_cversion=0; | |
| 9530 | |||
| 9531 | |||
| 9532 |
2/2✓ Branch 0 taken 409 times.
✓ Branch 1 taken 6 times.
|
415 | if(Header->zelda_version < 0x186) |
| 9533 | { | ||
| 9534 | 6 | weapons_to_read=64; | |
| 9535 | 6 | } | |
| 9536 | |||
| 9537 |
2/2✓ Branch 0 taken 409 times.
✓ Branch 1 taken 6 times.
|
415 | if(Header->zelda_version < 0x185) |
| 9538 | { | ||
| 9539 | 6 | weapons_to_read=32; | |
| 9540 | 6 | } | |
| 9541 | |||
| 9542 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 391 times.
|
415 | if(Header->zelda_version > 0x192) |
| 9543 | { | ||
| 9544 | 391 | weapons_to_read=0; | |
| 9545 | |||
| 9546 | //section version info | ||
| 9547 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | if(!p_igetw(&s_version,f)) |
| 9548 | { | ||
| 9549 | ✗ | return qe_invalid; | |
| 9550 | } | ||
| 9551 | |||
| 9552 | 391 | FFCore.quest_format[vWeaponSprites] = s_version; | |
| 9553 | |||
| 9554 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | if(!p_igetw(&s_cversion,f)) |
| 9555 | { | ||
| 9556 | ✗ | return qe_invalid; | |
| 9557 | } | ||
| 9558 | |||
| 9559 | //section size | ||
| 9560 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | if(!p_igetl(&dummy,f)) |
| 9561 | { | ||
| 9562 | ✗ | return qe_invalid; | |
| 9563 | } | ||
| 9564 | |||
| 9565 | //finally... section data | ||
| 9566 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | if(!p_igetw(&weapons_to_read,f)) |
| 9567 | { | ||
| 9568 | ✗ | return qe_invalid; | |
| 9569 | } | ||
| 9570 | |||
| 9571 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
|
391 | if (weapons_to_read > MAXWPNS) |
| 9572 | { | ||
| 9573 | ✗ | return qe_invalid; | |
| 9574 | } | ||
| 9575 | 391 | } | |
| 9576 | |||
| 9577 |
2/2✓ Branch 0 taken 332 times.
✓ Branch 1 taken 83 times.
|
415 | if(s_version>2) |
| 9578 | { | ||
| 9579 |
2/2✓ Branch 0 taken 84992 times.
✓ Branch 1 taken 332 times.
|
85324 | for(int32_t i=0; i<weapons_to_read; i++) |
| 9580 | { | ||
| 9581 | char tempname[64]; | ||
| 9582 | |||
| 9583 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if(!pfread(tempname, 64, f)) |
| 9584 | { | ||
| 9585 | ✗ | return qe_invalid; | |
| 9586 | } | ||
| 9587 | |||
| 9588 | 84992 | weapon_string[i][0] = '\0'; | |
| 9589 | 84992 | strncat(weapon_string[i], tempname, 64 - 1); | |
| 9590 | 84992 | } | |
| 9591 | |||
| 9592 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(s_version<4) |
| 9593 | { | ||
| 9594 | ✗ | strcpy(weapon_string[iwHover],old_weapon_string[iwHover]); | |
| 9595 | ✗ | strcpy(weapon_string[wFIREMAGIC],old_weapon_string[wFIREMAGIC]); | |
| 9596 | ✗ | } | |
| 9597 | |||
| 9598 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(s_version<5) |
| 9599 | { | ||
| 9600 | ✗ | strcpy(weapon_string[iwQuarterHearts],old_weapon_string[iwQuarterHearts]); | |
| 9601 | ✗ | } | |
| 9602 | |||
| 9603 | /* | ||
| 9604 | if (s_version<6) | ||
| 9605 | { | ||
| 9606 | strcpy(weapon_string[iwSideRaft],old_weapon_string[iwSideRaft]); | ||
| 9607 | strcpy(weapon_string[iwSideLadder],old_weapon_string[iwSideLadder]); | ||
| 9608 | } | ||
| 9609 | */ | ||
| 9610 | 332 | } | |
| 9611 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 82 times.
|
83 | else if (!should_skip) |
| 9612 | { | ||
| 9613 |
2/2✓ Branch 0 taken 20992 times.
✓ Branch 1 taken 82 times.
|
21074 | for(int32_t i=0; i<MAXWPNS; i++) |
| 9614 | 20992 | reset_weaponname(i); | |
| 9615 | 82 | } | |
| 9616 | |||
| 9617 |
2/2✓ Branch 0 taken 93804 times.
✓ Branch 1 taken 415 times.
|
94219 | for(int32_t i=0; i<weapons_to_read; i++) |
| 9618 | { | ||
| 9619 | 93804 | word oldtile = 0; | |
| 9620 |
2/2✓ Branch 0 taken 35328 times.
✓ Branch 1 taken 58476 times.
|
93804 | if (s_version < 8) |
| 9621 | { | ||
| 9622 |
1/2✓ Branch 0 taken 58476 times.
✗ Branch 1 not taken.
|
58476 | if (!p_igetw(&oldtile, f)) |
| 9623 | ✗ | return qe_invalid; | |
| 9624 | 58476 | } | |
| 9625 | |||
| 9626 |
1/2✓ Branch 0 taken 93804 times.
✗ Branch 1 not taken.
|
93804 | if(!p_getc(&tempweapon.misc,f)) |
| 9627 | { | ||
| 9628 | ✗ | return qe_invalid; | |
| 9629 | } | ||
| 9630 | |||
| 9631 |
1/2✓ Branch 0 taken 93804 times.
✗ Branch 1 not taken.
|
93804 | if(!p_getc(&tempweapon.csets,f)) |
| 9632 | { | ||
| 9633 | ✗ | return qe_invalid; | |
| 9634 | } | ||
| 9635 | |||
| 9636 |
1/2✓ Branch 0 taken 93804 times.
✗ Branch 1 not taken.
|
93804 | if(!p_getc(&tempweapon.frames,f)) |
| 9637 | { | ||
| 9638 | ✗ | return qe_invalid; | |
| 9639 | } | ||
| 9640 | |||
| 9641 |
1/2✓ Branch 0 taken 93804 times.
✗ Branch 1 not taken.
|
93804 | if(!p_getc(&tempweapon.speed,f)) |
| 9642 | { | ||
| 9643 | ✗ | return qe_invalid; | |
| 9644 | } | ||
| 9645 | |||
| 9646 |
1/2✓ Branch 0 taken 93804 times.
✗ Branch 1 not taken.
|
93804 | if(!p_getc(&tempweapon.type,f)) |
| 9647 | { | ||
| 9648 | ✗ | return qe_invalid; | |
| 9649 | } | ||
| 9650 | |||
| 9651 |
2/2✓ Branch 0 taken 57196 times.
✓ Branch 1 taken 36608 times.
|
93804 | if ( s_version >= 7 ) |
| 9652 | { | ||
| 9653 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if(!p_igetw(&tempweapon.script,f)) |
| 9654 | { | ||
| 9655 | ✗ | return qe_invalid; | |
| 9656 | } | ||
| 9657 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if(!p_igetl(&tempweapon.tile,f)) |
| 9658 | { | ||
| 9659 | ✗ | return qe_invalid; | |
| 9660 | } | ||
| 9661 | 36608 | } | |
| 9662 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 57196 times.
|
93804 | if ( s_version < 7 ) |
| 9663 | { | ||
| 9664 | 57196 | tempweapon.tile = oldtile; | |
| 9665 | 57196 | } | |
| 9666 | |||
| 9667 |
2/2✓ Branch 0 taken 89004 times.
✓ Branch 1 taken 4800 times.
|
93804 | if(Header->zelda_version < 0x193) |
| 9668 | { | ||
| 9669 |
1/2✓ Branch 0 taken 4800 times.
✗ Branch 1 not taken.
|
4800 | if(!p_getc(&padding,f)) |
| 9670 | { | ||
| 9671 | ✗ | return qe_invalid; | |
| 9672 | } | ||
| 9673 | 4800 | } | |
| 9674 | |||
| 9675 |
2/2✓ Branch 0 taken 84992 times.
✓ Branch 1 taken 8812 times.
|
93804 | if(s_version < 6) |
| 9676 | { | ||
| 9677 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 8794 times.
|
8812 | if(i==ewFIRETRAIL) |
| 9678 | { | ||
| 9679 | 18 | tempweapon.misc |= WF_BEHIND; | |
| 9680 | 18 | } | |
| 9681 | else | ||
| 9682 | 8794 | tempweapon.misc &= ~WF_BEHIND; | |
| 9683 | 8812 | } | |
| 9684 | |||
| 9685 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 93548 times.
|
93804 | if (!should_skip) |
| 9686 | 93548 | memcpy(&wpnsbuf[i], &tempweapon, sizeof(tempweapon)); | |
| 9687 | 93804 | } | |
| 9688 | |||
| 9689 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 414 times.
|
415 | if (should_skip) |
| 9690 | 1 | return 0; | |
| 9691 | |||
| 9692 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 332 times.
|
414 | if(s_version<2) |
| 9693 | { | ||
| 9694 | 82 | wpnsbuf[wSBOOM]=wpnsbuf[wBOOM]; | |
| 9695 | 82 | } | |
| 9696 | |||
| 9697 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 332 times.
|
414 | if(s_version<5) |
| 9698 | { | ||
| 9699 | 82 | wpnsbuf[iwQuarterHearts].tile=1; | |
| 9700 | 82 | wpnsbuf[iwQuarterHearts].csets=1; | |
| 9701 | 82 | } | |
| 9702 | |||
| 9703 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 414 times.
|
414 | if(Header->zelda_version < 0x176) |
| 9704 | { | ||
| 9705 | ✗ | wpnsbuf[iwSpawn] = *((wpndata*)(itemsbuf + iMisc1)); | |
| 9706 | ✗ | wpnsbuf[iwDeath] = *((wpndata*)(itemsbuf + iMisc2)); | |
| 9707 | ✗ | memset(&itemsbuf[iMisc1],0,sizeof(itemdata)); | |
| 9708 | ✗ | memset(&itemsbuf[iMisc2],0,sizeof(itemdata)); | |
| 9709 | ✗ | } | |
| 9710 | |||
| 9711 |
3/4✓ Branch 0 taken 396 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
|
419 | if((Header->zelda_version < 0x192)|| |
| 9712 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 391 times.
|
396 | ((Header->zelda_version == 0x192)&&(Header->build<129))) |
| 9713 | { | ||
| 9714 | 18 | wpnsbuf[wHSCHAIN_V] = wpnsbuf[wHSCHAIN_H]; | |
| 9715 | 18 | } | |
| 9716 | |||
| 9717 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 391 times.
|
414 | if((Header->zelda_version < 0x210)) |
| 9718 | { | ||
| 9719 | 23 | wpnsbuf[wLSHEAD] = wpnsbuf[wHSHEAD]; | |
| 9720 | 23 | wpnsbuf[wLSCHAIN_H] = wpnsbuf[wHSCHAIN_H]; | |
| 9721 | 23 | wpnsbuf[wLSHANDLE] = wpnsbuf[wHSHANDLE]; | |
| 9722 | 23 | wpnsbuf[wLSCHAIN_V] = wpnsbuf[wHSCHAIN_V]; | |
| 9723 | 23 | } | |
| 9724 | |||
| 9725 | 414 | return 0; | |
| 9726 | 415 | } | |
| 9727 | |||
| 9728 | 200678 | static void guy_update_firesfx(guydata& tempguy) | |
| 9729 | { | ||
| 9730 | 200678 | tempguy.firesfx = 0; | |
| 9731 |
2/2✓ Branch 0 taken 5768 times.
✓ Branch 1 taken 194910 times.
|
200678 | if (tempguy.family == eeWIZZ) |
| 9732 | { | ||
| 9733 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 888 times.
✓ Branch 2 taken 3527 times.
✓ Branch 3 taken 735 times.
✓ Branch 4 taken 618 times.
|
5768 | switch (tempguy.attributes[1]) |
| 9734 | { | ||
| 9735 | case 0: // normal weapon | ||
| 9736 | 3527 | tempguy.firesfx = WAV_WAND; | |
| 9737 | 3527 | break; | |
| 9738 | case 1: // 8 shots | ||
| 9739 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 653 times.
|
735 | if (get_qr(qr_8WAY_SHOT_SFX_DEP)) tempguy.firesfx = WAV_FIRE; |
| 9740 | else | ||
| 9741 | { | ||
| 9742 |
3/8✓ Branch 0 taken 560 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77 times.
✓ Branch 3 taken 16 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
653 | switch (tempguy.weapon) |
| 9743 | { | ||
| 9744 | case ewFireTrail: | ||
| 9745 | case ewFlame: | ||
| 9746 | case ewFlame2Trail: | ||
| 9747 | case ewFlame2: | ||
| 9748 | 560 | tempguy.firesfx = WAV_FIRE; | |
| 9749 | 560 | break; | |
| 9750 | case ewWind: | ||
| 9751 | case ewMagic: | ||
| 9752 | 77 | tempguy.firesfx = WAV_WAND; | |
| 9753 | 77 | break; | |
| 9754 | case ewIce: | ||
| 9755 | ✗ | tempguy.firesfx = WAV_ZN1ICE; | |
| 9756 | ✗ | break; | |
| 9757 | case ewRock: | ||
| 9758 | ✗ | tempguy.firesfx = WAV_ZN1ROCK; | |
| 9759 | ✗ | break; | |
| 9760 | case ewFireball2: | ||
| 9761 | case ewFireball: | ||
| 9762 | 16 | tempguy.firesfx = WAV_ZN1FIREBALL; | |
| 9763 | 16 | break; | |
| 9764 | case ewBrang: | ||
| 9765 | ✗ | tempguy.firesfx = WAV_BRANG; | |
| 9766 | ✗ | break; | |
| 9767 | case ewBomb:case ewSBomb: case ewLitBomb:case ewLitSBomb: | ||
| 9768 | ✗ | tempguy.firesfx = WAV_BOMB; | |
| 9769 | ✗ | break; | |
| 9770 | default: | ||
| 9771 | ✗ | tempguy.firesfx = 0; | |
| 9772 | ✗ | break; | |
| 9773 | } | ||
| 9774 | 653 | break; | |
| 9775 | } | ||
| 9776 | case 2: // Summon | ||
| 9777 | 970 | tempguy.firesfx = WAV_FIRE; | |
| 9778 | 970 | break; | |
| 9779 | case 3: // Summon Layer | ||
| 9780 | 618 | tempguy.firesfx = get_qr(qr_MORESOUNDS) ? WAV_ZN1SUMMON : WAV_FIRE; | |
| 9781 | 618 | break; | |
| 9782 | } | ||
| 9783 | 5768 | } | |
| 9784 | else | ||
| 9785 | { | ||
| 9786 |
6/6✓ Branch 0 taken 147740 times.
✓ Branch 1 taken 47170 times.
✓ Branch 2 taken 37526 times.
✓ Branch 3 taken 185266 times.
✓ Branch 4 taken 42350 times.
✓ Branch 5 taken 42346 times.
|
194910 | if ((tempguy.family == eeWALK || tempguy.family == eePROJECTILE) && (tempguy.attributes[0] == e1tSUMMON || tempguy.attributes[0] == e1tSUMMONLAYER)) |
| 9787 | { | ||
| 9788 | 84696 | tempguy.firesfx = get_qr(qr_MORESOUNDS) ? WAV_ZN1SUMMON : WAV_FIRE; | |
| 9789 | 84696 | } | |
| 9790 | else | ||
| 9791 | { | ||
| 9792 |
7/8✓ Branch 0 taken 8552 times.
✓ Branch 1 taken 2105 times.
✓ Branch 2 taken 1614 times.
✓ Branch 3 taken 11482 times.
✓ Branch 4 taken 155957 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 3536 times.
✓ Branch 7 taken 2020 times.
|
185266 | switch (tempguy.weapon) |
| 9793 | { | ||
| 9794 | case ewFireTrail: | ||
| 9795 | case ewFlame: | ||
| 9796 | case ewFlame2Trail: | ||
| 9797 | case ewFlame2: | ||
| 9798 | 8552 | tempguy.firesfx = WAV_FIRE; | |
| 9799 | 8552 | break; | |
| 9800 | case ewWind: | ||
| 9801 | case ewMagic: | ||
| 9802 | 1614 | tempguy.firesfx = WAV_WAND; | |
| 9803 | 1614 | break; | |
| 9804 | case ewIce: | ||
| 9805 | ✗ | tempguy.firesfx = WAV_ZN1ICE; | |
| 9806 | ✗ | break; | |
| 9807 | case ewRock: | ||
| 9808 | 3536 | tempguy.firesfx = WAV_ZN1ROCK; | |
| 9809 | 3536 | break; | |
| 9810 | case ewFireball2: | ||
| 9811 | case ewFireball: | ||
| 9812 | 11482 | tempguy.firesfx = WAV_ZN1FIREBALL; | |
| 9813 | 11482 | break; | |
| 9814 | case ewBrang: | ||
| 9815 | 2020 | tempguy.firesfx = WAV_BRANG; | |
| 9816 | 2020 | break; | |
| 9817 | case ewBomb:case ewSBomb: case ewLitBomb:case ewLitSBomb: | ||
| 9818 | 2105 | tempguy.firesfx = WAV_BOMB; | |
| 9819 | 2105 | break; | |
| 9820 | default: | ||
| 9821 | 155957 | tempguy.firesfx = 0; | |
| 9822 | 155957 | break; | |
| 9823 | } | ||
| 9824 | } | ||
| 9825 | } | ||
| 9826 | 191038 | } | |
| 9827 | |||
| 9828 | 191038 | static void guy_update_weaponflags(guydata& tempguy) | |
| 9829 | { | ||
| 9830 | 191038 | tempguy.wunblockable = 0; | |
| 9831 | 191038 | tempguy.wmoveflags = move_none; | |
| 9832 |
4/4✓ Branch 0 taken 185247 times.
✓ Branch 1 taken 5791 times.
✓ Branch 2 taken 2678 times.
✓ Branch 3 taken 182569 times.
|
191038 | if (tempguy.weapon == ewFlame || tempguy.weapon == ewFireTrail) |
| 9833 | 8469 | tempguy.wmoveflags |= (move_obeys_grav | move_can_pitfall); | |
| 9834 | 191038 | tempguy.weapoverrideFLAGS = 0; | |
| 9835 | 191038 | tempguy.weap_hxofs = 0; | |
| 9836 | 191038 | tempguy.weap_hyofs = 0; | |
| 9837 | 191038 | tempguy.weap_hxsz = 0; | |
| 9838 | 191038 | tempguy.weap_hysz = 0; | |
| 9839 | 191038 | tempguy.weap_hzsz = 0; | |
| 9840 | 191038 | tempguy.weap_xofs = 0; | |
| 9841 | 191038 | tempguy.weap_yofs = 0; | |
| 9842 | 191038 | tempguy.weap_tilew = 0; | |
| 9843 | 191038 | tempguy.weap_tileh = 0; | |
| 9844 |
5/5✓ Branch 0 taken 2246 times.
✓ Branch 1 taken 154165 times.
✓ Branch 2 taken 16570 times.
✓ Branch 3 taken 11498 times.
✓ Branch 4 taken 6559 times.
|
191038 | switch (tempguy.weapon) |
| 9845 | { | ||
| 9846 | case ewFireball: case ewFireball2: | ||
| 9847 | 11498 | tempguy.wstep = 175; | |
| 9848 | 11498 | break; | |
| 9849 | case ewSword: case ewLitBomb: case ewLitSBomb: | ||
| 9850 | case ewRock: case ewMagic: case ewWind: | ||
| 9851 | 16570 | tempguy.wstep = 300; | |
| 9852 | 16570 | break; | |
| 9853 | case ewArrow: | ||
| 9854 | 2246 | tempguy.wstep = 200; | |
| 9855 | 2246 | break; | |
| 9856 | case ewFlame: case ewFlame2: | ||
| 9857 | 6559 | tempguy.wstep = 100; | |
| 9858 | 6559 | break; | |
| 9859 | default: | ||
| 9860 | 154165 | tempguy.wstep = 0; | |
| 9861 | 154165 | break; | |
| 9862 | } | ||
| 9863 |
2/2✓ Branch 0 taken 955190 times.
✓ Branch 1 taken 191038 times.
|
1146228 | for (int q = 0; q < WPNSPR_MAX; ++q) |
| 9864 | { | ||
| 9865 | 955190 | tempguy.burnsprs[q] = 0; | |
| 9866 | 955190 | tempguy.light_rads[q] = 0; | |
| 9867 | 955190 | } | |
| 9868 | 191038 | } | |
| 9869 | |||
| 9870 | 191038 | static void guy_update_weaponspecialsfx(guydata& tempguy) | |
| 9871 | { | ||
| 9872 |
3/3✓ Branch 0 taken 2020 times.
✓ Branch 1 taken 186859 times.
✓ Branch 2 taken 2159 times.
|
191038 | switch (tempguy.weapon) |
| 9873 | { | ||
| 9874 | case ewBrang: | ||
| 9875 | 2020 | tempguy.specialsfx = WAV_BRANG; | |
| 9876 | 2020 | break; | |
| 9877 | case ewBomb: case ewSBomb: case ewLitBomb:case ewLitSBomb: | ||
| 9878 | 2159 | tempguy.specialsfx = WAV_BOMB; | |
| 9879 | 2159 | break; | |
| 9880 | default: | ||
| 9881 | 186859 | tempguy.specialsfx = 0; | |
| 9882 | 186859 | break; | |
| 9883 | } | ||
| 9884 | 191038 | } | |
| 9885 | |||
| 9886 | 414 | void init_guys(int32_t guyversion) | |
| 9887 | { | ||
| 9888 |
2/2✓ Branch 0 taken 211968 times.
✓ Branch 1 taken 414 times.
|
212382 | for(int32_t i=0; i<MAXGUYS; i++) |
| 9889 | { | ||
| 9890 | 211968 | guysbuf[i] = default_guys[0]; | |
| 9891 | 211968 | } | |
| 9892 | |||
| 9893 |
2/2✓ Branch 0 taken 73278 times.
✓ Branch 1 taken 414 times.
|
73692 | for(int32_t i=0; i<OLDMAXGUYS; i++) |
| 9894 | { | ||
| 9895 | 73278 | guysbuf[i] = default_guys[i]; | |
| 9896 |
2/2✓ Branch 0 taken 72450 times.
✓ Branch 1 taken 828 times.
|
73278 | guysbuf[i].spr_shadow = (guysbuf[i].family==eeROCK && guysbuf[i].attributes[9] == 1) ? iwLargeShadow : iwShadow; |
| 9897 | 73278 | guysbuf[i].spr_death = iwDeath; | |
| 9898 | 73278 | guysbuf[i].spr_spawn = iwSpawn; | |
| 9899 | // Patra fix: 2.10 BSPatras used spDIG. 2.50 Patras use CSet 7. | ||
| 9900 |
4/4✓ Branch 0 taken 14514 times.
✓ Branch 1 taken 58764 times.
✓ Branch 2 taken 14432 times.
✓ Branch 3 taken 82 times.
|
73278 | if(guyversion<=3 && i==ePATRABS) |
| 9901 | { | ||
| 9902 | 82 | guysbuf[i].bosspal=spDIG; | |
| 9903 | 82 | guysbuf[i].cset=14; | |
| 9904 | 82 | guysbuf[i].attributes[8] = 14; | |
| 9905 | 82 | } | |
| 9906 | |||
| 9907 |
2/2✓ Branch 0 taken 58764 times.
✓ Branch 1 taken 14514 times.
|
73278 | if(guyversion<=3) |
| 9908 | { | ||
| 9909 | // Rope/Ghini Flash rules | ||
| 9910 |
2/2✓ Branch 0 taken 4071 times.
✓ Branch 1 taken 10443 times.
|
14514 | if(get_bit(deprecated_rules, qr_NOROPE2FLASH_DEP)) |
| 9911 | { | ||
| 9912 |
2/2✓ Branch 0 taken 10384 times.
✓ Branch 1 taken 59 times.
|
10443 | if(i==eROPE2) |
| 9913 | { | ||
| 9914 | 59 | guysbuf[i].flags &= ~guy_flashing; | |
| 9915 | 59 | } | |
| 9916 | 10443 | } | |
| 9917 | |||
| 9918 |
2/2✓ Branch 0 taken 12390 times.
✓ Branch 1 taken 2124 times.
|
14514 | if(get_bit(deprecated_rules, qr_NOBUBBLEFLASH_DEP)) |
| 9919 | { | ||
| 9920 |
12/12✓ Branch 0 taken 2112 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 2100 times.
✓ Branch 3 taken 12 times.
✓ Branch 4 taken 2088 times.
✓ Branch 5 taken 12 times.
✓ Branch 6 taken 2076 times.
✓ Branch 7 taken 12 times.
✓ Branch 8 taken 2064 times.
✓ Branch 9 taken 12 times.
✓ Branch 10 taken 12 times.
✓ Branch 11 taken 2052 times.
|
2124 | if(i==eBUBBLEST || i==eBUBBLESP || i==eBUBBLESR || i==eBUBBLEIT || i==eBUBBLEIP || i==eBUBBLEIR) |
| 9921 | { | ||
| 9922 | 72 | guysbuf[i].flags &= ~guy_flashing; | |
| 9923 | 72 | } | |
| 9924 | 2124 | } | |
| 9925 | |||
| 9926 |
2/2✓ Branch 0 taken 14432 times.
✓ Branch 1 taken 82 times.
|
14514 | if(i==eGHINI2) |
| 9927 | { | ||
| 9928 |
2/2✓ Branch 0 taken 78 times.
✓ Branch 1 taken 4 times.
|
82 | if(get_bit(deprecated_rules, qr_GHINI2BLINK_DEP)) |
| 9929 | { | ||
| 9930 | 4 | guysbuf[i].flags |= guy_blinking; | |
| 9931 | 4 | } | |
| 9932 | |||
| 9933 |
2/2✓ Branch 0 taken 44 times.
✓ Branch 1 taken 38 times.
|
82 | if(get_bit(deprecated_rules, qr_PHANTOMGHINI2_DEP)) |
| 9934 | { | ||
| 9935 | 38 | guysbuf[i].flags |= guy_transparent; | |
| 9936 | 38 | } | |
| 9937 | 82 | } | |
| 9938 | |||
| 9939 |
4/4✓ Branch 0 taken 14432 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 82 times.
✓ Branch 3 taken 14350 times.
|
14514 | if (i == eDIG1 || i == eDIG3) |
| 9940 | { | ||
| 9941 | 164 | guysbuf[i].flags |= guy_ignore_kill_all; | |
| 9942 | 164 | } | |
| 9943 | 14514 | } | |
| 9944 | |||
| 9945 | // Darknut fix | ||
| 9946 |
10/10✓ Branch 0 taken 72864 times.
✓ Branch 1 taken 414 times.
✓ Branch 2 taken 72450 times.
✓ Branch 3 taken 414 times.
✓ Branch 4 taken 72036 times.
✓ Branch 5 taken 414 times.
✓ Branch 6 taken 71622 times.
✓ Branch 7 taken 414 times.
✓ Branch 8 taken 414 times.
✓ Branch 9 taken 71208 times.
|
73278 | if(i==eDKNUT1 || i==eDKNUT2 || i==eDKNUT3 || i==eDKNUT4 || i==eDKNUT5) |
| 9947 | { | ||
| 9948 |
2/2✓ Branch 0 taken 1710 times.
✓ Branch 1 taken 360 times.
|
2070 | if(get_qr(qr_NEWENEMYTILES)) |
| 9949 | { | ||
| 9950 | 1710 | guysbuf[i].s_tile=guysbuf[i].e_tile+120; | |
| 9951 | 1710 | guysbuf[i].s_width=guysbuf[i].e_width; | |
| 9952 | 1710 | guysbuf[i].s_height=guysbuf[i].e_height; | |
| 9953 | 1710 | } | |
| 9954 | 360 | else guysbuf[i].s_tile=860; | |
| 9955 | |||
| 9956 |
2/2✓ Branch 0 taken 320 times.
✓ Branch 1 taken 1750 times.
|
2070 | if(!get_bit(deprecated_rules,qr_BRKBLSHLDS_DEP)) |
| 9957 | 1750 | guysbuf[i].flags &= ~guy_bkshield; | |
| 9958 | else | ||
| 9959 | 320 | guysbuf[i].flags |= guy_bkshield; | |
| 9960 | 2070 | } | |
| 9961 | |||
| 9962 |
4/4✓ Branch 0 taken 72864 times.
✓ Branch 1 taken 414 times.
✓ Branch 2 taken 73228 times.
✓ Branch 3 taken 50 times.
|
73278 | if((i==eGELTRIB || i==eFGELTRIB) && get_bit(deprecated_rules,qr_OLDTRIBBLES_DEP)) |
| 9963 | { | ||
| 9964 | 50 | guysbuf[i].attributes[2] = (i == eFGELTRIB ? eFZOL : eZOL); | |
| 9965 | 50 | } | |
| 9966 | |||
| 9967 | 73278 | guy_update_firesfx(guysbuf[i]); | |
| 9968 | 73278 | guy_update_weaponflags(guysbuf[i]); | |
| 9969 | 73278 | guy_update_weaponspecialsfx(guysbuf[i]); | |
| 9970 | 73278 | } | |
| 9971 | 414 | } | |
| 9972 | |||
| 9973 | 20992 | void reset_weaponname(int32_t i) | |
| 9974 | { | ||
| 9975 |
2/2✓ Branch 0 taken 7216 times.
✓ Branch 1 taken 13776 times.
|
20992 | if(i<wLast) |
| 9976 | { | ||
| 9977 | 7216 | strcpy(weapon_string[i],old_weapon_string[i]); | |
| 9978 | 7216 | } | |
| 9979 | else | ||
| 9980 | 13776 | sprintf(weapon_string[i],"zz%03d",i); | |
| 9981 | 20992 | } | |
| 9982 | |||
| 9983 | 414 | void init_item_drop_sets() | |
| 9984 | { | ||
| 9985 |
2/2✓ Branch 0 taken 105984 times.
✓ Branch 1 taken 414 times.
|
106398 | for(int32_t i=0; i<MAXITEMDROPSETS; i++) |
| 9986 | { | ||
| 9987 | // item_drop_sets[i] = default_item_drop_sets[0]; | ||
| 9988 | 105984 | memset(&item_drop_sets[i], 0, sizeof(item_drop_object)); | |
| 9989 | 105984 | } | |
| 9990 | |||
| 9991 |
2/2✓ Branch 0 taken 5382 times.
✓ Branch 1 taken 414 times.
|
5796 | for(int32_t i=0; i<isMAX; i++) |
| 9992 | { | ||
| 9993 | 5382 | item_drop_sets[i] = default_item_drop_sets[i]; | |
| 9994 | |||
| 9995 | // Deprecated: qr_NOCLOCKS and qr_ALLOW10RUPEEDROPS | ||
| 9996 |
2/2✓ Branch 0 taken 53820 times.
✓ Branch 1 taken 5382 times.
|
59202 | for(int32_t j=0; j<10; ++j) |
| 9997 | { | ||
| 9998 | 53820 | int32_t it = item_drop_sets[i].item[j]; | |
| 9999 | |||
| 10000 |
3/4✓ Branch 0 taken 37904 times.
✓ Branch 1 taken 15916 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2442 times.
|
53820 | if((itemsbuf[it].family == itype_rupee && ((itemsbuf[it].amount)&0xFFF) == 10) |
| 10001 |
2/2✓ Branch 0 taken 2442 times.
✓ Branch 1 taken 35462 times.
|
37904 | && !get_bit(deprecated_rules, qr_ALLOW10RUPEEDROPS_DEP)) |
| 10002 | { | ||
| 10003 | 2442 | item_drop_sets[i].chance[j+1]=0; | |
| 10004 | 2442 | } | |
| 10005 |
4/4✓ Branch 0 taken 1656 times.
✓ Branch 1 taken 49722 times.
✓ Branch 2 taken 144 times.
✓ Branch 3 taken 1512 times.
|
51378 | else if(itemsbuf[it].family == itype_clock && get_bit(deprecated_rules, qr_NOCLOCKS_DEP)) |
| 10006 | { | ||
| 10007 | 144 | item_drop_sets[i].chance[j+1]=0; | |
| 10008 | 144 | } | |
| 10009 | |||
| 10010 | // From Sept 2007 to Dec 2008, non-gameplay items were prohibited. | ||
| 10011 |
2/2✓ Branch 0 taken 53796 times.
✓ Branch 1 taken 24 times.
|
53820 | if(itemsbuf[it].family == itype_misc) |
| 10012 | { | ||
| 10013 | // If a non-gameplay item was selected, then item drop was aborted. | ||
| 10014 | // Reflect this by increasing the 'Nothing' chance accordingly. | ||
| 10015 | 24 | item_drop_sets[i].chance[0]+=item_drop_sets[i].chance[j+1]; | |
| 10016 | 24 | item_drop_sets[i].chance[j+1]=0; | |
| 10017 | 24 | } | |
| 10018 | 53820 | } | |
| 10019 | 5382 | } | |
| 10020 | 414 | } | |
| 10021 | |||
| 10022 | 414 | void init_favorites() | |
| 10023 | { | ||
| 10024 |
2/2✓ Branch 0 taken 521640 times.
✓ Branch 1 taken 414 times.
|
522054 | for(int32_t i=0; i<MAXFAVORITECOMBOS; i++) |
| 10025 | { | ||
| 10026 | 521640 | favorite_combos[i]=-1; | |
| 10027 | 521640 | } | |
| 10028 | 414 | } | |
| 10029 | |||
| 10030 | const char *ctype_name[cMAX]= | ||
| 10031 | { | ||
| 10032 | "cNONE", "cSTAIR", "cCAVE", "cWATER", "cARMOS", "cGRAVE", "cDOCK", | ||
| 10033 | "cUNDEF", "cPUSH_WAIT", "cPUSH_HEAVY", "cPUSH_HW", "cL_STATUE", "cR_STATUE", | ||
| 10034 | "cWALKSLOW", "cCVUP", "cCVDOWN", "cCVLEFT", "cCVRIGHT", "cSWIMWARP", "cDIVEWARP", | ||
| 10035 | "cLADDERHOOKSHOT", "cTRIGNOFLAG", "cTRIGFLAG", "cZELDA", "cSLASH", "cSLASHITEM", | ||
| 10036 | "cPUSH_HEAVY2", "cPUSH_HW2", "cPOUND", "cHSGRAB", "cHSBRIDGE", "cDAMAGE1", | ||
| 10037 | "cDAMAGE2", "cDAMAGE3", "cDAMAGE4", "cC_STATUE", "cTRAP_H", "cTRAP_V", "cTRAP_4", | ||
| 10038 | "cTRAP_LR", "cTRAP_UD", "cPIT", "cHOOKSHOTONLY", "cOVERHEAD", "cNOFLYZONE", "cMIRROR", | ||
| 10039 | "cMIRRORSLASH", "cMIRRORBACKSLASH", "cMAGICPRISM", "cMAGICPRISM4", | ||
| 10040 | "cMAGICSPONGE", "cCAVE2", "cEYEBALL_A", "cEYEBALL_B", "cNOJUMPZONE", "cBUSH", | ||
| 10041 | "cFLOWERS", "cTALLGRASS", "cSHALLOWWATER", "cLOCKBLOCK", "cLOCKBLOCK2", | ||
| 10042 | "cBOSSLOCKBLOCK", "cBOSSLOCKBLOCK2", "cLADDERONLY", "cBSGRAVE", | ||
| 10043 | "cCHEST", "cCHEST2", "cLOCKEDCHEST", "cLOCKEDCHEST2", "cBOSSCHEST", "cBOSSCHEST2", | ||
| 10044 | "cRESET", "cSAVE", "cSAVE2", "cCAVEB", "cCAVEC", "cCAVED", | ||
| 10045 | "cSTAIRB", "cSTAIRC", "cSTAIRD", "cPITB", "cPITC", "cPITD", | ||
| 10046 | "cCAVE2B", "cCAVE2C", "cCAVE2D", "cSWIMWARPB", "cSWIMWARPC", "cSWIMWARPD", | ||
| 10047 | "cDIVEWARPB", "cDIVEWARPC", "cDIVEWARPD", "cSTAIRR", "cPITR", | ||
| 10048 | "cAWARPA", "cAWARPB", "cAWARPC", "cAWARPD", "cAWARPR", | ||
| 10049 | "cSWARPA", "cSWARPB", "cSWARPC", "cSWARPD", "cSWARPR", "cSTRIGNOFLAG", "cSTRIGFLAG", | ||
| 10050 | "cSTEP", "cSTEPSAME", "cSTEPALL", "cSTEPCOPY", "cNOENEMY", "cBLOCKARROW1", "cBLOCKARROW2", | ||
| 10051 | "cBLOCKARROW3", "cBLOCKBRANG1", "cBLOCKBRANG2", "cBLOCKBRANG3", "cBLOCKSBEAM", "cBLOCKALL", | ||
| 10052 | "cBLOCKFIREBALL", "cDAMAGE5", "cDAMAGE6", "cDAMAGE7", "cCHANGE", "cSPINTILE1", "cSPINTILE2", | ||
| 10053 | "cSCREENFREEZE", "cSCREENFREEZEFF", "cNOGROUNDENEMY", "cSLASHNEXT", "cSLASHNEXTITEM", "cBUSHNEXT" | ||
| 10054 | "cSLASHTOUCHY", "cSLASHITEMTOUCHY", "cBUSHTOUCHY", "cFLOWERSTOUCHY", "cTALLGRASSTOUCHY", | ||
| 10055 | "cSLASHNEXTTOUCHY", "cSLASHNEXTITEMTOUCHY", "cBUSHNEXTTOUCHY", "cEYEBALL_4", "cTALLGRASSNEXT", | ||
| 10056 | "cSCRIPT1", "cSCRIPT2", "cSCRIPT3", "cSCRIPT4", "cSCRIPT5", | ||
| 10057 | "cSCRIPT6", "cSCRIPT7", "cSCRIPT8", "cSCRIPT9", "cSCRIPT10", | ||
| 10058 | "cSCRIPT11", "cSCRIPT12", "cSCRIPT13", "cSCRIPT14", "cSCRIPT15", | ||
| 10059 | "cSCRIPT16", "cSCRIPT17", "cSCRIPT18", "cSCRIPT19", "cSCRIPT20" | ||
| 10060 | |||
| 10061 | }; | ||
| 10062 | |||
| 10063 | 690 | int32_t init_combo_classes() | |
| 10064 | { | ||
| 10065 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 690 times.
|
690 | zinfo* zi = (load_tmp_zi ? load_tmp_zi : &ZI); |
| 10066 |
2/2✓ Branch 0 taken 126270 times.
✓ Branch 1 taken 690 times.
|
126960 | for(int32_t i=0; i<cMAX; i++) |
| 10067 | { | ||
| 10068 | 126270 | combo_class_buf[i] = default_combo_classes[i]; | |
| 10069 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 126270 times.
|
126270 | if ( char const* nm = zi->getComboTypeName(i) ) |
| 10070 | { | ||
| 10071 | 126270 | size_t len = strlen(nm); | |
| 10072 |
2/2✓ Branch 0 taken 8081280 times.
✓ Branch 1 taken 126270 times.
|
8207550 | for ( size_t q = 0; q < 64; q++ ) |
| 10073 | { | ||
| 10074 |
2/2✓ Branch 0 taken 1849890 times.
✓ Branch 1 taken 6231390 times.
|
8081280 | combo_class_buf[i].name[q] = (q<len ? nm[q] : 0); |
| 10075 | 8081280 | } | |
| 10076 | 126270 | } | |
| 10077 | 126270 | } | |
| 10078 | |||
| 10079 | 690 | return 0; | |
| 10080 | } | ||
| 10081 | |||
| 10082 | 294 | int32_t readherosprites2(PACKFILE *f, int32_t v_herosprites, int32_t cv_herosprites) | |
| 10083 | { | ||
| 10084 |
2/2✓ Branch 0 taken 46 times.
✓ Branch 1 taken 248 times.
|
294 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_herosprites); |
| 10085 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 294 times.
|
294 | if (should_skip) return 0; |
| 10086 | |||
| 10087 |
1/2✓ Branch 0 taken 294 times.
✗ Branch 1 not taken.
|
294 | assert(v_herosprites < 6); |
| 10088 | //these are here to bypass compiler warnings about unused arguments | ||
| 10089 | 294 | cv_herosprites=cv_herosprites; | |
| 10090 | |||
| 10091 | 294 | zinit.hero_swim_speed=67; //default | |
| 10092 | 294 | setupherotiles(zinit.heroAnimationStyle); | |
| 10093 | 294 | setupherodefenses(); | |
| 10094 | 294 | setupherooffsets(); | |
| 10095 | |||
| 10096 |
2/2✓ Branch 0 taken 105 times.
✓ Branch 1 taken 189 times.
|
294 | if(v_herosprites>=0) |
| 10097 | { | ||
| 10098 | word tile, tile2; | ||
| 10099 | byte flip, extend, dummy_byte; | ||
| 10100 | |||
| 10101 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 189 times.
|
945 | for(int32_t i=0; i<4; i++) |
| 10102 | { | ||
| 10103 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_igetw(&tile,f)) |
| 10104 | { | ||
| 10105 | ✗ | return qe_invalid; | |
| 10106 | } | ||
| 10107 | |||
| 10108 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&flip,f)) |
| 10109 | { | ||
| 10110 | ✗ | return qe_invalid; | |
| 10111 | } | ||
| 10112 | |||
| 10113 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&extend,f)) |
| 10114 | { | ||
| 10115 | ✗ | return qe_invalid; | |
| 10116 | } | ||
| 10117 | |||
| 10118 | 756 | walkspr[i][spr_tile]=(int32_t)tile; | |
| 10119 | 756 | walkspr[i][spr_flip]=(int32_t)flip; | |
| 10120 | 756 | walkspr[i][spr_extend]=(int32_t)extend; | |
| 10121 | 756 | } | |
| 10122 | |||
| 10123 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 189 times.
|
945 | for(int32_t i=0; i<4; i++) |
| 10124 | { | ||
| 10125 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_igetw(&tile,f)) |
| 10126 | { | ||
| 10127 | ✗ | return qe_invalid; | |
| 10128 | } | ||
| 10129 | |||
| 10130 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&flip,f)) |
| 10131 | { | ||
| 10132 | ✗ | return qe_invalid; | |
| 10133 | } | ||
| 10134 | |||
| 10135 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&extend,f)) |
| 10136 | { | ||
| 10137 | ✗ | return qe_invalid; | |
| 10138 | } | ||
| 10139 | |||
| 10140 | 756 | stabspr[i][spr_tile]=(int32_t)tile; | |
| 10141 | 756 | stabspr[i][spr_flip]=(int32_t)flip; | |
| 10142 | 756 | stabspr[i][spr_extend]=(int32_t)extend; | |
| 10143 | 756 | } | |
| 10144 | |||
| 10145 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 189 times.
|
945 | for(int32_t i=0; i<4; i++) |
| 10146 | { | ||
| 10147 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_igetw(&tile,f)) |
| 10148 | { | ||
| 10149 | ✗ | return qe_invalid; | |
| 10150 | } | ||
| 10151 | |||
| 10152 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&flip,f)) |
| 10153 | { | ||
| 10154 | ✗ | return qe_invalid; | |
| 10155 | } | ||
| 10156 | |||
| 10157 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&extend,f)) |
| 10158 | { | ||
| 10159 | ✗ | return qe_invalid; | |
| 10160 | } | ||
| 10161 | |||
| 10162 | 756 | slashspr[i][spr_tile]=(int32_t)tile; | |
| 10163 | 756 | slashspr[i][spr_flip]=(int32_t)flip; | |
| 10164 | 756 | slashspr[i][spr_extend]=(int32_t)extend; | |
| 10165 | 756 | } | |
| 10166 | |||
| 10167 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 189 times.
|
945 | for(int32_t i=0; i<4; i++) |
| 10168 | { | ||
| 10169 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_igetw(&tile,f)) |
| 10170 | { | ||
| 10171 | ✗ | return qe_invalid; | |
| 10172 | } | ||
| 10173 | |||
| 10174 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&flip,f)) |
| 10175 | { | ||
| 10176 | ✗ | return qe_invalid; | |
| 10177 | } | ||
| 10178 | |||
| 10179 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&extend,f)) |
| 10180 | { | ||
| 10181 | ✗ | return qe_invalid; | |
| 10182 | } | ||
| 10183 | |||
| 10184 | 756 | floatspr[i][spr_tile]=(int32_t)tile; | |
| 10185 | 756 | floatspr[i][spr_flip]=(int32_t)flip; | |
| 10186 | 756 | floatspr[i][spr_extend]=(int32_t)extend; | |
| 10187 | 756 | } | |
| 10188 | |||
| 10189 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 189 times.
|
189 | if(v_herosprites>1) |
| 10190 | { | ||
| 10191 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 189 times.
|
945 | for(int32_t i=0; i<4; i++) |
| 10192 | { | ||
| 10193 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_igetw(&tile,f)) |
| 10194 | { | ||
| 10195 | ✗ | return qe_invalid; | |
| 10196 | } | ||
| 10197 | |||
| 10198 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&flip,f)) |
| 10199 | { | ||
| 10200 | ✗ | return qe_invalid; | |
| 10201 | } | ||
| 10202 | |||
| 10203 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&extend,f)) |
| 10204 | { | ||
| 10205 | ✗ | return qe_invalid; | |
| 10206 | } | ||
| 10207 | |||
| 10208 | 756 | swimspr[i][spr_tile]=(int32_t)tile; | |
| 10209 | 756 | swimspr[i][spr_flip]=(int32_t)flip; | |
| 10210 | 756 | swimspr[i][spr_extend]=(int32_t)extend; | |
| 10211 | 756 | } | |
| 10212 | 189 | } | |
| 10213 | |||
| 10214 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 189 times.
|
945 | for(int32_t i=0; i<4; i++) |
| 10215 | { | ||
| 10216 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_igetw(&tile,f)) |
| 10217 | { | ||
| 10218 | ✗ | return qe_invalid; | |
| 10219 | } | ||
| 10220 | |||
| 10221 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&flip,f)) |
| 10222 | { | ||
| 10223 | ✗ | return qe_invalid; | |
| 10224 | } | ||
| 10225 | |||
| 10226 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&extend,f)) |
| 10227 | { | ||
| 10228 | ✗ | return qe_invalid; | |
| 10229 | } | ||
| 10230 | |||
| 10231 | 756 | divespr[i][spr_tile]=(int32_t)tile; | |
| 10232 | 756 | divespr[i][spr_flip]=(int32_t)flip; | |
| 10233 | 756 | divespr[i][spr_extend]=(int32_t)extend; | |
| 10234 | 756 | } | |
| 10235 | |||
| 10236 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 189 times.
|
945 | for(int32_t i=0; i<4; i++) |
| 10237 | { | ||
| 10238 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_igetw(&tile,f)) |
| 10239 | { | ||
| 10240 | ✗ | return qe_invalid; | |
| 10241 | } | ||
| 10242 | |||
| 10243 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&flip,f)) |
| 10244 | { | ||
| 10245 | ✗ | return qe_invalid; | |
| 10246 | } | ||
| 10247 | |||
| 10248 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&extend,f)) |
| 10249 | { | ||
| 10250 | ✗ | return qe_invalid; | |
| 10251 | } | ||
| 10252 | |||
| 10253 | 756 | poundspr[i][spr_tile]=(int32_t)tile; | |
| 10254 | 756 | poundspr[i][spr_flip]=(int32_t)flip; | |
| 10255 | 756 | poundspr[i][spr_extend]=(int32_t)extend; | |
| 10256 | 756 | } | |
| 10257 | |||
| 10258 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(!p_igetw(&tile,f)) |
| 10259 | { | ||
| 10260 | ✗ | return qe_invalid; | |
| 10261 | } | ||
| 10262 | |||
| 10263 | 189 | flip=0; | |
| 10264 | |||
| 10265 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 189 times.
|
189 | if(v_herosprites>0) |
| 10266 | { | ||
| 10267 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(!p_getc(&flip,f)) |
| 10268 | { | ||
| 10269 | ✗ | return qe_invalid; | |
| 10270 | } | ||
| 10271 | 189 | } | |
| 10272 | |||
| 10273 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(!p_getc(&extend,f)) |
| 10274 | { | ||
| 10275 | ✗ | return qe_invalid; | |
| 10276 | } | ||
| 10277 | |||
| 10278 | 189 | castingspr[spr_tile]=(int32_t)tile; | |
| 10279 | 189 | castingspr[spr_flip]=(int32_t)flip; | |
| 10280 | 189 | castingspr[spr_extend]=(int32_t)extend; | |
| 10281 | |||
| 10282 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(v_herosprites>0) |
| 10283 | { | ||
| 10284 | 189 | int32_t num_holdsprs = (v_herosprites > 6 ? 3 : 2); | |
| 10285 |
2/2✓ Branch 0 taken 378 times.
✓ Branch 1 taken 189 times.
|
567 | for(int32_t i=0; i<2; i++) |
| 10286 | { | ||
| 10287 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 378 times.
|
1134 | for(int32_t j=0; j<num_holdsprs; j++) |
| 10288 | { | ||
| 10289 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_igetw(&tile,f)) |
| 10290 | { | ||
| 10291 | ✗ | return qe_invalid; | |
| 10292 | } | ||
| 10293 | |||
| 10294 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&flip,f)) |
| 10295 | { | ||
| 10296 | ✗ | return qe_invalid; | |
| 10297 | } | ||
| 10298 | |||
| 10299 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&extend,f)) |
| 10300 | { | ||
| 10301 | ✗ | return qe_invalid; | |
| 10302 | } | ||
| 10303 | |||
| 10304 | 756 | holdspr[i][j][spr_tile]=(int32_t)tile; | |
| 10305 | 756 | holdspr[i][j][spr_flip]=(int32_t)flip; | |
| 10306 | 756 | holdspr[i][j][spr_extend]=(int32_t)extend; | |
| 10307 | 756 | } | |
| 10308 | 378 | } | |
| 10309 | 189 | } | |
| 10310 | else | ||
| 10311 | { | ||
| 10312 | ✗ | for(int32_t i=0; i<2; i++) | |
| 10313 | { | ||
| 10314 | ✗ | if(!p_igetw(&tile,f)) | |
| 10315 | { | ||
| 10316 | ✗ | return qe_invalid; | |
| 10317 | } | ||
| 10318 | |||
| 10319 | ✗ | if(!p_igetw(&tile2,f)) | |
| 10320 | { | ||
| 10321 | ✗ | return qe_invalid; | |
| 10322 | } | ||
| 10323 | |||
| 10324 | ✗ | if(!p_getc(&extend,f)) | |
| 10325 | { | ||
| 10326 | ✗ | return qe_invalid; | |
| 10327 | } | ||
| 10328 | |||
| 10329 | ✗ | holdspr[i][spr_hold1][spr_tile]=(int32_t)tile; | |
| 10330 | ✗ | holdspr[i][spr_hold1][spr_flip]=(int32_t)flip; | |
| 10331 | ✗ | holdspr[i][spr_hold1][spr_extend]=(int32_t)extend; | |
| 10332 | ✗ | holdspr[i][spr_hold2][spr_tile]=(int32_t)tile2; | |
| 10333 | ✗ | holdspr[i][spr_hold2][spr_flip]=(int32_t)flip; | |
| 10334 | ✗ | holdspr[i][spr_hold2][spr_extend]=(int32_t)extend; | |
| 10335 | ✗ | } | |
| 10336 | } | ||
| 10337 | |||
| 10338 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 189 times.
|
189 | if(v_herosprites>2) |
| 10339 | { | ||
| 10340 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 189 times.
|
945 | for(int32_t i=0; i<4; i++) |
| 10341 | { | ||
| 10342 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_igetw(&tile,f)) |
| 10343 | { | ||
| 10344 | ✗ | return qe_invalid; | |
| 10345 | } | ||
| 10346 | |||
| 10347 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&flip,f)) |
| 10348 | { | ||
| 10349 | ✗ | return qe_invalid; | |
| 10350 | } | ||
| 10351 | |||
| 10352 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&extend,f)) |
| 10353 | { | ||
| 10354 | ✗ | return qe_invalid; | |
| 10355 | } | ||
| 10356 | |||
| 10357 | 756 | jumpspr[i][spr_tile]=(int32_t)tile; | |
| 10358 | 756 | jumpspr[i][spr_flip]=(int32_t)flip; | |
| 10359 | 756 | jumpspr[i][spr_extend]=(int32_t)extend; | |
| 10360 | 756 | } | |
| 10361 | 189 | } | |
| 10362 | |||
| 10363 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 189 times.
|
189 | if(v_herosprites>3) |
| 10364 | { | ||
| 10365 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 189 times.
|
945 | for(int32_t i=0; i<4; i++) |
| 10366 | { | ||
| 10367 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_igetw(&tile,f)) |
| 10368 | { | ||
| 10369 | ✗ | return qe_invalid; | |
| 10370 | } | ||
| 10371 | |||
| 10372 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if(!p_getc(&flip,f)) |
| 10373 | { | ||
| 10374 | ✗ | return qe_invalid; | |
| 10375 | } | ||
| 10376 | |||
| 10377 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 756 times.
|
756 | if(!p_getc(&extend,f)) |
| 10378 | { | ||
| 10379 | ✗ | return qe_invalid; | |
| 10380 | } | ||
| 10381 | |||
| 10382 | 756 | chargespr[i][spr_tile]=(int32_t)tile; | |
| 10383 | 756 | chargespr[i][spr_flip]=(int32_t)flip; | |
| 10384 | 756 | chargespr[i][spr_extend]=(int32_t)extend; | |
| 10385 | 756 | } | |
| 10386 | 189 | } | |
| 10387 | |||
| 10388 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 189 times.
|
189 | if(v_herosprites>4) |
| 10389 | { | ||
| 10390 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(!p_getc(&dummy_byte,f)) |
| 10391 | { | ||
| 10392 | ✗ | return qe_invalid; | |
| 10393 | } | ||
| 10394 | |||
| 10395 | 189 | zinit.hero_swim_speed=(byte)dummy_byte; | |
| 10396 | 189 | } | |
| 10397 | |||
| 10398 | 189 | memset(frozenspr, 0, sizeof(frozenspr)); | |
| 10399 | 189 | memset(frozen_waterspr, 0, sizeof(frozen_waterspr)); | |
| 10400 | 189 | memset(onfirespr, 0, sizeof(onfirespr)); | |
| 10401 | 189 | memset(onfire_waterspr, 0, sizeof(onfire_waterspr)); | |
| 10402 | 189 | memset(diggingspr, 0, sizeof(diggingspr)); | |
| 10403 | 189 | memset(usingrodspr, 0, sizeof(usingrodspr)); | |
| 10404 | 189 | memset(usingcanespr, 0, sizeof(usingcanespr)); | |
| 10405 | 189 | memset(pushingspr, 0, sizeof(pushingspr)); | |
| 10406 | 189 | memset(liftingspr, 0, sizeof(liftingspr)); | |
| 10407 | 189 | memset(liftingwalkspr, 0, sizeof(liftingwalkspr)); | |
| 10408 | 189 | memset(stunnedspr, 0, sizeof(stunnedspr)); | |
| 10409 | 189 | memset(stunned_waterspr, 0, sizeof(stunned_waterspr)); | |
| 10410 | 189 | memset(fallingspr, 0, sizeof(fallingspr)); | |
| 10411 | 189 | memset(shockedspr, 0, sizeof(shockedspr)); | |
| 10412 | 189 | memset(shocked_waterspr, 0, sizeof(shocked_waterspr)); | |
| 10413 | 189 | memset(pullswordspr, 0, sizeof(pullswordspr)); | |
| 10414 | 189 | memset(readingspr, 0, sizeof(readingspr)); | |
| 10415 | 189 | memset(slash180spr, 0, sizeof(slash180spr)); | |
| 10416 | 189 | memset(slashZ4spr, 0, sizeof(slashZ4spr)); | |
| 10417 | 189 | memset(dashspr, 0, sizeof(dashspr)); | |
| 10418 | 189 | memset(bonkspr, 0, sizeof(bonkspr)); | |
| 10419 | 189 | memset(medallionsprs, 0, sizeof(medallionsprs)); | |
| 10420 | 189 | memset(holdspr[0][2], 0, sizeof(holdspr[0][2])); //Sword hold (Land) | |
| 10421 | 189 | memset(holdspr[1][2], 0, sizeof(holdspr[1][2])); //Sword hold (Water) | |
| 10422 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 189 times.
|
945 | for(int32_t q = 0; q < 4; ++q) |
| 10423 | { | ||
| 10424 |
2/2✓ Branch 0 taken 2268 times.
✓ Branch 1 taken 756 times.
|
3024 | for(int32_t p = 0; p < 3; ++p) |
| 10425 | { | ||
| 10426 | 2268 | drowningspr[q][p] = divespr[q][p]; | |
| 10427 | 2268 | drowning_lavaspr[q][p] = divespr[q][p]; | |
| 10428 | 2268 | } | |
| 10429 | 756 | } | |
| 10430 | 189 | memset(sideswimspr, 0, sizeof(sideswimspr)); | |
| 10431 | 189 | memset(sideswimslashspr, 0, sizeof(sideswimslashspr)); | |
| 10432 | 189 | memset(sideswimstabspr, 0, sizeof(sideswimstabspr)); | |
| 10433 | 189 | memset(sideswimpoundspr, 0, sizeof(sideswimpoundspr)); | |
| 10434 | 189 | memset(sideswimchargespr, 0, sizeof(sideswimchargespr)); | |
| 10435 | 189 | memset(sideswimholdspr, 0, sizeof(sideswimholdspr)); | |
| 10436 | 189 | memset(sidedrowningspr, 0, sizeof(sidedrowningspr)); | |
| 10437 | 189 | } | |
| 10438 | |||
| 10439 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 294 times.
|
294 | if(FFCore.quest_format[vInitData] < 34) |
| 10440 | { | ||
| 10441 | 294 | bool fastswim = zinit.hero_swim_speed > 60; | |
| 10442 | // '2/3' or '1/2' | ||
| 10443 | 294 | zinit.hero_swim_mult = fastswim ? 2 : 1; | |
| 10444 | 294 | zinit.hero_swim_div = fastswim ? 3 : 2; | |
| 10445 | 294 | } | |
| 10446 | 294 | return 0; | |
| 10447 | 294 | } | |
| 10448 | |||
| 10449 | 24310 | void setSprite(int32_t* arr, int32_t tile, int32_t flip, int32_t ext) | |
| 10450 | { | ||
| 10451 | 24310 | arr[spr_tile] = tile; | |
| 10452 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24310 times.
|
24310 | arr[spr_flip] = (flip > 3 ? 0 : flip); |
| 10453 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24310 times.
|
24310 | arr[spr_extend] = (ext > 2 ? 0 : ext); |
| 10454 | 24310 | } | |
| 10455 | //Used to read the player sprites as int32_t, not word. | ||
| 10456 | 143 | int32_t readherosprites3(PACKFILE *f, int32_t v_herosprites, int32_t cv_herosprites) | |
| 10457 | { | ||
| 10458 | //these are here to bypass compiler warnings about unused arguments | ||
| 10459 | 143 | cv_herosprites=cv_herosprites; | |
| 10460 | |||
| 10461 | 143 | zinit.hero_swim_speed=67; //default | |
| 10462 | 143 | setupherotiles(zinit.heroAnimationStyle); | |
| 10463 | 143 | setupherodefenses(); | |
| 10464 | 143 | setupherooffsets(); | |
| 10465 | |||
| 10466 | int32_t tile, tile2; | ||
| 10467 | byte flip, extend, dummy_byte; | ||
| 10468 | |||
| 10469 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 143 times.
|
143 | if(v_herosprites>=0) |
| 10470 | { | ||
| 10471 | |||
| 10472 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t i=0; i<4; i++) |
| 10473 | { | ||
| 10474 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 10475 | { | ||
| 10476 | ✗ | return qe_invalid; | |
| 10477 | } | ||
| 10478 | |||
| 10479 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&flip,f)) |
| 10480 | { | ||
| 10481 | ✗ | return qe_invalid; | |
| 10482 | } | ||
| 10483 | |||
| 10484 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&extend,f)) |
| 10485 | { | ||
| 10486 | ✗ | return qe_invalid; | |
| 10487 | } | ||
| 10488 | |||
| 10489 | 572 | setSprite(walkspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10490 | 572 | } | |
| 10491 | |||
| 10492 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t i=0; i<4; i++) |
| 10493 | { | ||
| 10494 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 10495 | { | ||
| 10496 | ✗ | return qe_invalid; | |
| 10497 | } | ||
| 10498 | |||
| 10499 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&flip,f)) |
| 10500 | { | ||
| 10501 | ✗ | return qe_invalid; | |
| 10502 | } | ||
| 10503 | |||
| 10504 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&extend,f)) |
| 10505 | { | ||
| 10506 | ✗ | return qe_invalid; | |
| 10507 | } | ||
| 10508 | |||
| 10509 | 572 | setSprite(stabspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10510 | 572 | } | |
| 10511 | |||
| 10512 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t i=0; i<4; i++) |
| 10513 | { | ||
| 10514 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 10515 | { | ||
| 10516 | ✗ | return qe_invalid; | |
| 10517 | } | ||
| 10518 | |||
| 10519 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&flip,f)) |
| 10520 | { | ||
| 10521 | ✗ | return qe_invalid; | |
| 10522 | } | ||
| 10523 | |||
| 10524 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&extend,f)) |
| 10525 | { | ||
| 10526 | ✗ | return qe_invalid; | |
| 10527 | } | ||
| 10528 | |||
| 10529 | 572 | setSprite(slashspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10530 | 572 | } | |
| 10531 | |||
| 10532 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t i=0; i<4; i++) |
| 10533 | { | ||
| 10534 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 10535 | { | ||
| 10536 | ✗ | return qe_invalid; | |
| 10537 | } | ||
| 10538 | |||
| 10539 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&flip,f)) |
| 10540 | { | ||
| 10541 | ✗ | return qe_invalid; | |
| 10542 | } | ||
| 10543 | |||
| 10544 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&extend,f)) |
| 10545 | { | ||
| 10546 | ✗ | return qe_invalid; | |
| 10547 | } | ||
| 10548 | |||
| 10549 | 572 | setSprite(floatspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10550 | 572 | } | |
| 10551 | |||
| 10552 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 143 times.
|
143 | if(v_herosprites>1) |
| 10553 | { | ||
| 10554 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t i=0; i<4; i++) |
| 10555 | { | ||
| 10556 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 10557 | { | ||
| 10558 | ✗ | return qe_invalid; | |
| 10559 | } | ||
| 10560 | |||
| 10561 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&flip,f)) |
| 10562 | { | ||
| 10563 | ✗ | return qe_invalid; | |
| 10564 | } | ||
| 10565 | |||
| 10566 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&extend,f)) |
| 10567 | { | ||
| 10568 | ✗ | return qe_invalid; | |
| 10569 | } | ||
| 10570 | |||
| 10571 | 572 | setSprite(swimspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10572 | 572 | } | |
| 10573 | 143 | } | |
| 10574 | |||
| 10575 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t i=0; i<4; i++) |
| 10576 | { | ||
| 10577 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 10578 | { | ||
| 10579 | ✗ | return qe_invalid; | |
| 10580 | } | ||
| 10581 | |||
| 10582 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&flip,f)) |
| 10583 | { | ||
| 10584 | ✗ | return qe_invalid; | |
| 10585 | } | ||
| 10586 | |||
| 10587 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&extend,f)) |
| 10588 | { | ||
| 10589 | ✗ | return qe_invalid; | |
| 10590 | } | ||
| 10591 | |||
| 10592 | 572 | setSprite(divespr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10593 | 572 | } | |
| 10594 | |||
| 10595 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t i=0; i<4; i++) |
| 10596 | { | ||
| 10597 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 10598 | { | ||
| 10599 | ✗ | return qe_invalid; | |
| 10600 | } | ||
| 10601 | |||
| 10602 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&flip,f)) |
| 10603 | { | ||
| 10604 | ✗ | return qe_invalid; | |
| 10605 | } | ||
| 10606 | |||
| 10607 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&extend,f)) |
| 10608 | { | ||
| 10609 | ✗ | return qe_invalid; | |
| 10610 | } | ||
| 10611 | |||
| 10612 | 572 | setSprite(poundspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10613 | 572 | } | |
| 10614 | |||
| 10615 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_igetl(&tile,f)) |
| 10616 | { | ||
| 10617 | ✗ | return qe_invalid; | |
| 10618 | } | ||
| 10619 | |||
| 10620 | 143 | flip=0; | |
| 10621 | |||
| 10622 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 143 times.
|
143 | if(v_herosprites>0) |
| 10623 | { | ||
| 10624 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_getc(&flip,f)) |
| 10625 | { | ||
| 10626 | ✗ | return qe_invalid; | |
| 10627 | } | ||
| 10628 | 143 | } | |
| 10629 | |||
| 10630 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_getc(&extend,f)) |
| 10631 | { | ||
| 10632 | ✗ | return qe_invalid; | |
| 10633 | } | ||
| 10634 | |||
| 10635 | 143 | setSprite(castingspr, int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10636 | |||
| 10637 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(v_herosprites>0) |
| 10638 | { | ||
| 10639 | 143 | int32_t num_holdsprs = (v_herosprites > 6 ? 3 : 2); | |
| 10640 |
2/2✓ Branch 0 taken 286 times.
✓ Branch 1 taken 143 times.
|
429 | for(int32_t i=0; i<2; i++) |
| 10641 | { | ||
| 10642 |
2/2✓ Branch 0 taken 858 times.
✓ Branch 1 taken 286 times.
|
1144 | for(int32_t j=0; j<num_holdsprs; j++) |
| 10643 | { | ||
| 10644 |
1/2✓ Branch 0 taken 858 times.
✗ Branch 1 not taken.
|
858 | if(!p_igetl(&tile,f)) |
| 10645 | { | ||
| 10646 | ✗ | return qe_invalid; | |
| 10647 | } | ||
| 10648 | |||
| 10649 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 858 times.
|
858 | if(!p_getc(&flip,f)) |
| 10650 | { | ||
| 10651 | ✗ | return qe_invalid; | |
| 10652 | } | ||
| 10653 | |||
| 10654 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 858 times.
|
858 | if(!p_getc(&extend,f)) |
| 10655 | { | ||
| 10656 | ✗ | return qe_invalid; | |
| 10657 | } | ||
| 10658 | |||
| 10659 | 858 | setSprite(holdspr[i][j], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10660 | 858 | } | |
| 10661 | 286 | } | |
| 10662 | 143 | } | |
| 10663 | else | ||
| 10664 | { | ||
| 10665 | ✗ | for(int32_t i=0; i<2; i++) | |
| 10666 | { | ||
| 10667 | ✗ | if(!p_igetl(&tile,f)) | |
| 10668 | { | ||
| 10669 | ✗ | return qe_invalid; | |
| 10670 | } | ||
| 10671 | |||
| 10672 | ✗ | if(!p_igetl(&tile2,f)) | |
| 10673 | { | ||
| 10674 | ✗ | return qe_invalid; | |
| 10675 | } | ||
| 10676 | |||
| 10677 | ✗ | if(!p_getc(&extend,f)) | |
| 10678 | { | ||
| 10679 | ✗ | return qe_invalid; | |
| 10680 | } | ||
| 10681 | |||
| 10682 | ✗ | setSprite(holdspr[i][spr_hold1], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10683 | ✗ | setSprite(holdspr[i][spr_hold2], int32_t(tile2), int32_t(flip), int32_t(extend)); | |
| 10684 | ✗ | } | |
| 10685 | } | ||
| 10686 | |||
| 10687 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 143 times.
|
143 | if(v_herosprites>2) |
| 10688 | { | ||
| 10689 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t i=0; i<4; i++) |
| 10690 | { | ||
| 10691 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 10692 | { | ||
| 10693 | ✗ | return qe_invalid; | |
| 10694 | } | ||
| 10695 | |||
| 10696 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&flip,f)) |
| 10697 | { | ||
| 10698 | ✗ | return qe_invalid; | |
| 10699 | } | ||
| 10700 | |||
| 10701 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&extend,f)) |
| 10702 | { | ||
| 10703 | ✗ | return qe_invalid; | |
| 10704 | } | ||
| 10705 | |||
| 10706 | 572 | setSprite(jumpspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10707 | 572 | } | |
| 10708 | 143 | } | |
| 10709 | |||
| 10710 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 143 times.
|
143 | if(v_herosprites>3) |
| 10711 | { | ||
| 10712 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t i=0; i<4; i++) |
| 10713 | { | ||
| 10714 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 10715 | { | ||
| 10716 | ✗ | return qe_invalid; | |
| 10717 | } | ||
| 10718 | |||
| 10719 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&flip,f)) |
| 10720 | { | ||
| 10721 | ✗ | return qe_invalid; | |
| 10722 | } | ||
| 10723 | |||
| 10724 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&extend,f)) |
| 10725 | { | ||
| 10726 | ✗ | return qe_invalid; | |
| 10727 | } | ||
| 10728 | |||
| 10729 | 572 | setSprite(chargespr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10730 | 572 | } | |
| 10731 | 143 | } | |
| 10732 | |||
| 10733 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 143 times.
|
143 | if(v_herosprites>4) |
| 10734 | { | ||
| 10735 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_getc(&dummy_byte,f)) |
| 10736 | { | ||
| 10737 | ✗ | return qe_invalid; | |
| 10738 | } | ||
| 10739 | |||
| 10740 | 143 | zinit.hero_swim_speed=(byte)dummy_byte; | |
| 10741 | 143 | } | |
| 10742 | |||
| 10743 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(v_herosprites>6) |
| 10744 | { | ||
| 10745 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 10746 | { | ||
| 10747 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 10748 | ✗ | return qe_invalid; | |
| 10749 | |||
| 10750 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&flip,f)) |
| 10751 | ✗ | return qe_invalid; | |
| 10752 | |||
| 10753 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&extend,f)) |
| 10754 | ✗ | return qe_invalid; | |
| 10755 | |||
| 10756 | 572 | setSprite(frozenspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10757 | 572 | } | |
| 10758 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 10759 | { | ||
| 10760 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 10761 | ✗ | return qe_invalid; | |
| 10762 | |||
| 10763 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&flip,f)) |
| 10764 | ✗ | return qe_invalid; | |
| 10765 | |||
| 10766 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&extend,f)) |
| 10767 | ✗ | return qe_invalid; | |
| 10768 | |||
| 10769 | 572 | setSprite(frozen_waterspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10770 | 572 | } | |
| 10771 | |||
| 10772 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 10773 | { | ||
| 10774 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 10775 | ✗ | return qe_invalid; | |
| 10776 | |||
| 10777 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&flip,f)) |
| 10778 | ✗ | return qe_invalid; | |
| 10779 | |||
| 10780 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&extend,f)) |
| 10781 | ✗ | return qe_invalid; | |
| 10782 | |||
| 10783 | 572 | setSprite(onfirespr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10784 | 572 | } | |
| 10785 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 10786 | { | ||
| 10787 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 10788 | ✗ | return qe_invalid; | |
| 10789 | |||
| 10790 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&flip,f)) |
| 10791 | ✗ | return qe_invalid; | |
| 10792 | |||
| 10793 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&extend,f)) |
| 10794 | ✗ | return qe_invalid; | |
| 10795 | |||
| 10796 | 572 | setSprite(onfire_waterspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10797 | 572 | } | |
| 10798 | |||
| 10799 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 10800 | { | ||
| 10801 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 10802 | ✗ | return qe_invalid; | |
| 10803 | |||
| 10804 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&flip,f)) |
| 10805 | ✗ | return qe_invalid; | |
| 10806 | |||
| 10807 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&extend,f)) |
| 10808 | ✗ | return qe_invalid; | |
| 10809 | |||
| 10810 | 572 | setSprite(diggingspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10811 | 572 | } | |
| 10812 | |||
| 10813 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 10814 | { | ||
| 10815 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 10816 | ✗ | return qe_invalid; | |
| 10817 | |||
| 10818 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&flip,f)) |
| 10819 | ✗ | return qe_invalid; | |
| 10820 | |||
| 10821 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&extend,f)) |
| 10822 | ✗ | return qe_invalid; | |
| 10823 | |||
| 10824 | 572 | setSprite(usingrodspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10825 | 572 | } | |
| 10826 | |||
| 10827 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 10828 | { | ||
| 10829 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 10830 | ✗ | return qe_invalid; | |
| 10831 | |||
| 10832 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&flip,f)) |
| 10833 | ✗ | return qe_invalid; | |
| 10834 | |||
| 10835 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&extend,f)) |
| 10836 | ✗ | return qe_invalid; | |
| 10837 | |||
| 10838 | 572 | setSprite(usingcanespr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10839 | 572 | } | |
| 10840 | |||
| 10841 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 10842 | { | ||
| 10843 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 10844 | ✗ | return qe_invalid; | |
| 10845 | |||
| 10846 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&flip,f)) |
| 10847 | ✗ | return qe_invalid; | |
| 10848 | |||
| 10849 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&extend,f)) |
| 10850 | ✗ | return qe_invalid; | |
| 10851 | |||
| 10852 | 572 | setSprite(pushingspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10853 | 572 | } | |
| 10854 | |||
| 10855 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 10856 | { | ||
| 10857 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 10858 | ✗ | return qe_invalid; | |
| 10859 | |||
| 10860 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&flip,f)) |
| 10861 | ✗ | return qe_invalid; | |
| 10862 | |||
| 10863 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&extend,f)) |
| 10864 | ✗ | return qe_invalid; | |
| 10865 | |||
| 10866 | 572 | byte frames = 0; | |
| 10867 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 552 times.
|
572 | if(v_herosprites > 15) |
| 10868 | { | ||
| 10869 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 552 times.
|
552 | if(!p_getc(&frames,f)) |
| 10870 | ✗ | return qe_invalid; | |
| 10871 | 552 | } | |
| 10872 | |||
| 10873 | 572 | setSprite(liftingspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10874 | 572 | liftingspr[q][spr_frames] = frames; | |
| 10875 | 572 | } | |
| 10876 | |||
| 10877 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 10878 | { | ||
| 10879 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 10880 | ✗ | return qe_invalid; | |
| 10881 | |||
| 10882 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&flip,f)) |
| 10883 | ✗ | return qe_invalid; | |
| 10884 | |||
| 10885 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&extend,f)) |
| 10886 | ✗ | return qe_invalid; | |
| 10887 | |||
| 10888 | 572 | setSprite(liftingwalkspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10889 | 572 | } | |
| 10890 | |||
| 10891 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 10892 | { | ||
| 10893 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_igetl(&tile,f)) |
| 10894 | ✗ | return qe_invalid; | |
| 10895 | |||
| 10896 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&flip,f)) |
| 10897 | ✗ | return qe_invalid; | |
| 10898 | |||
| 10899 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&extend,f)) |
| 10900 | ✗ | return qe_invalid; | |
| 10901 | |||
| 10902 | 572 | setSprite(stunnedspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10903 | 572 | } | |
| 10904 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 10905 | { | ||
| 10906 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 10907 | ✗ | return qe_invalid; | |
| 10908 | |||
| 10909 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&flip,f)) |
| 10910 | ✗ | return qe_invalid; | |
| 10911 | |||
| 10912 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&extend,f)) |
| 10913 | ✗ | return qe_invalid; | |
| 10914 | |||
| 10915 | 572 | setSprite(stunned_waterspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10916 | 572 | } | |
| 10917 | |||
| 10918 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 10919 | { | ||
| 10920 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 10921 | ✗ | return qe_invalid; | |
| 10922 | |||
| 10923 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&flip,f)) |
| 10924 | ✗ | return qe_invalid; | |
| 10925 | |||
| 10926 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&extend,f)) |
| 10927 | ✗ | return qe_invalid; | |
| 10928 | |||
| 10929 | 572 | setSprite(drowningspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10930 | 572 | } | |
| 10931 | |||
| 10932 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 10933 | { | ||
| 10934 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 10935 | ✗ | return qe_invalid; | |
| 10936 | |||
| 10937 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&flip,f)) |
| 10938 | ✗ | return qe_invalid; | |
| 10939 | |||
| 10940 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&extend,f)) |
| 10941 | ✗ | return qe_invalid; | |
| 10942 | |||
| 10943 | 572 | setSprite(drowning_lavaspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10944 | 572 | } | |
| 10945 | |||
| 10946 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 10947 | { | ||
| 10948 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 10949 | ✗ | return qe_invalid; | |
| 10950 | |||
| 10951 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&flip,f)) |
| 10952 | ✗ | return qe_invalid; | |
| 10953 | |||
| 10954 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&extend,f)) |
| 10955 | ✗ | return qe_invalid; | |
| 10956 | |||
| 10957 | 572 | setSprite(fallingspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10958 | 572 | } | |
| 10959 | |||
| 10960 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 10961 | { | ||
| 10962 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 10963 | ✗ | return qe_invalid; | |
| 10964 | |||
| 10965 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&flip,f)) |
| 10966 | ✗ | return qe_invalid; | |
| 10967 | |||
| 10968 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&extend,f)) |
| 10969 | ✗ | return qe_invalid; | |
| 10970 | |||
| 10971 | 572 | setSprite(shockedspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10972 | 572 | } | |
| 10973 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 10974 | { | ||
| 10975 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 10976 | ✗ | return qe_invalid; | |
| 10977 | |||
| 10978 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&flip,f)) |
| 10979 | ✗ | return qe_invalid; | |
| 10980 | |||
| 10981 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&extend,f)) |
| 10982 | ✗ | return qe_invalid; | |
| 10983 | |||
| 10984 | 572 | setSprite(shocked_waterspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10985 | 572 | } | |
| 10986 | |||
| 10987 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 10988 | { | ||
| 10989 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 10990 | ✗ | return qe_invalid; | |
| 10991 | |||
| 10992 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&flip,f)) |
| 10993 | ✗ | return qe_invalid; | |
| 10994 | |||
| 10995 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&extend,f)) |
| 10996 | ✗ | return qe_invalid; | |
| 10997 | |||
| 10998 | 572 | setSprite(pullswordspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10999 | 572 | } | |
| 11000 | |||
| 11001 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 11002 | { | ||
| 11003 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 11004 | ✗ | return qe_invalid; | |
| 11005 | |||
| 11006 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&flip,f)) |
| 11007 | ✗ | return qe_invalid; | |
| 11008 | |||
| 11009 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&extend,f)) |
| 11010 | ✗ | return qe_invalid; | |
| 11011 | |||
| 11012 | 572 | setSprite(readingspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11013 | 572 | } | |
| 11014 | |||
| 11015 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 11016 | { | ||
| 11017 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_igetl(&tile,f)) |
| 11018 | ✗ | return qe_invalid; | |
| 11019 | |||
| 11020 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&flip,f)) |
| 11021 | ✗ | return qe_invalid; | |
| 11022 | |||
| 11023 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&extend,f)) |
| 11024 | ✗ | return qe_invalid; | |
| 11025 | |||
| 11026 | 572 | setSprite(slash180spr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11027 | 572 | } | |
| 11028 | |||
| 11029 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 11030 | { | ||
| 11031 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 11032 | ✗ | return qe_invalid; | |
| 11033 | |||
| 11034 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&flip,f)) |
| 11035 | ✗ | return qe_invalid; | |
| 11036 | |||
| 11037 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&extend,f)) |
| 11038 | ✗ | return qe_invalid; | |
| 11039 | |||
| 11040 | 572 | setSprite(slashZ4spr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11041 | 572 | } | |
| 11042 | |||
| 11043 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 11044 | { | ||
| 11045 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 11046 | ✗ | return qe_invalid; | |
| 11047 | |||
| 11048 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&flip,f)) |
| 11049 | ✗ | return qe_invalid; | |
| 11050 | |||
| 11051 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&extend,f)) |
| 11052 | ✗ | return qe_invalid; | |
| 11053 | |||
| 11054 | 572 | setSprite(dashspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11055 | 572 | } | |
| 11056 | |||
| 11057 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 11058 | { | ||
| 11059 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 11060 | ✗ | return qe_invalid; | |
| 11061 | |||
| 11062 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&flip,f)) |
| 11063 | ✗ | return qe_invalid; | |
| 11064 | |||
| 11065 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_getc(&extend,f)) |
| 11066 | ✗ | return qe_invalid; | |
| 11067 | |||
| 11068 | 572 | setSprite(bonkspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11069 | 572 | } | |
| 11070 | |||
| 11071 |
2/2✓ Branch 0 taken 429 times.
✓ Branch 1 taken 143 times.
|
572 | for(int32_t q = 0; q < 3; ++q) //Not directions; number of medallion sprs |
| 11072 | { | ||
| 11073 |
1/2✓ Branch 0 taken 429 times.
✗ Branch 1 not taken.
|
429 | if(!p_igetl(&tile,f)) |
| 11074 | ✗ | return qe_invalid; | |
| 11075 | |||
| 11076 |
1/2✓ Branch 0 taken 429 times.
✗ Branch 1 not taken.
|
429 | if(!p_getc(&flip,f)) |
| 11077 | ✗ | return qe_invalid; | |
| 11078 | |||
| 11079 |
1/2✓ Branch 0 taken 429 times.
✗ Branch 1 not taken.
|
429 | if(!p_getc(&extend,f)) |
| 11080 | ✗ | return qe_invalid; | |
| 11081 | |||
| 11082 | 429 | setSprite(medallionsprs[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11083 | 429 | } | |
| 11084 | 143 | } | |
| 11085 | else | ||
| 11086 | { | ||
| 11087 | ✗ | memset(frozenspr, 0, sizeof(frozenspr)); | |
| 11088 | ✗ | memset(frozen_waterspr, 0, sizeof(frozen_waterspr)); | |
| 11089 | ✗ | memset(onfirespr, 0, sizeof(onfirespr)); | |
| 11090 | ✗ | memset(onfire_waterspr, 0, sizeof(onfire_waterspr)); | |
| 11091 | ✗ | memset(diggingspr, 0, sizeof(diggingspr)); | |
| 11092 | ✗ | memset(usingrodspr, 0, sizeof(usingrodspr)); | |
| 11093 | ✗ | memset(usingcanespr, 0, sizeof(usingcanespr)); | |
| 11094 | ✗ | memset(pushingspr, 0, sizeof(pushingspr)); | |
| 11095 | ✗ | memset(liftingspr, 0, sizeof(liftingspr)); | |
| 11096 | ✗ | memset(liftingwalkspr, 0, sizeof(liftingwalkspr)); | |
| 11097 | ✗ | memset(stunnedspr, 0, sizeof(stunnedspr)); | |
| 11098 | ✗ | memset(stunned_waterspr, 0, sizeof(stunned_waterspr)); | |
| 11099 | ✗ | memset(fallingspr, 0, sizeof(fallingspr)); | |
| 11100 | ✗ | memset(shockedspr, 0, sizeof(shockedspr)); | |
| 11101 | ✗ | memset(shocked_waterspr, 0, sizeof(shocked_waterspr)); | |
| 11102 | ✗ | memset(pullswordspr, 0, sizeof(pullswordspr)); | |
| 11103 | ✗ | memset(readingspr, 0, sizeof(readingspr)); | |
| 11104 | ✗ | memset(slash180spr, 0, sizeof(slash180spr)); | |
| 11105 | ✗ | memset(slashZ4spr, 0, sizeof(slashZ4spr)); | |
| 11106 | ✗ | memset(dashspr, 0, sizeof(dashspr)); | |
| 11107 | ✗ | memset(bonkspr, 0, sizeof(bonkspr)); | |
| 11108 | ✗ | memset(medallionsprs, 0, sizeof(medallionsprs)); | |
| 11109 | ✗ | memset(holdspr[0][2], 0, sizeof(holdspr[0][2])); //Sword hold (Land) | |
| 11110 | ✗ | memset(holdspr[1][2], 0, sizeof(holdspr[1][2])); //Sword hold (Water) | |
| 11111 | ✗ | for(int32_t q = 0; q < 4; ++q) | |
| 11112 | { | ||
| 11113 | ✗ | for(int32_t p = 0; p < 3; ++p) | |
| 11114 | { | ||
| 11115 | ✗ | drowningspr[q][p] = divespr[q][p]; | |
| 11116 | ✗ | drowning_lavaspr[q][p] = divespr[q][p]; | |
| 11117 | ✗ | } | |
| 11118 | ✗ | } | |
| 11119 | } | ||
| 11120 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if (v_herosprites > 8) |
| 11121 | { | ||
| 11122 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 11123 | { | ||
| 11124 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 11125 | ✗ | return qe_invalid; | |
| 11126 | |||
| 11127 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&flip,f)) |
| 11128 | ✗ | return qe_invalid; | |
| 11129 | |||
| 11130 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&extend,f)) |
| 11131 | ✗ | return qe_invalid; | |
| 11132 | |||
| 11133 | 572 | setSprite(sideswimspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11134 | 572 | } | |
| 11135 | 143 | } | |
| 11136 | else | ||
| 11137 | { | ||
| 11138 | ✗ | memset(sideswimspr, 0, sizeof(sideswimspr)); | |
| 11139 | } | ||
| 11140 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if (v_herosprites > 9) |
| 11141 | { | ||
| 11142 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 11143 | { | ||
| 11144 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 11145 | ✗ | return qe_invalid; | |
| 11146 | |||
| 11147 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&flip,f)) |
| 11148 | ✗ | return qe_invalid; | |
| 11149 | |||
| 11150 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&extend,f)) |
| 11151 | ✗ | return qe_invalid; | |
| 11152 | |||
| 11153 | 572 | setSprite(sideswimslashspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11154 | 572 | } | |
| 11155 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 11156 | { | ||
| 11157 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 11158 | ✗ | return qe_invalid; | |
| 11159 | |||
| 11160 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&flip,f)) |
| 11161 | ✗ | return qe_invalid; | |
| 11162 | |||
| 11163 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&extend,f)) |
| 11164 | ✗ | return qe_invalid; | |
| 11165 | |||
| 11166 | 572 | setSprite(sideswimstabspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11167 | 572 | } | |
| 11168 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 11169 | { | ||
| 11170 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 11171 | ✗ | return qe_invalid; | |
| 11172 | |||
| 11173 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&flip,f)) |
| 11174 | ✗ | return qe_invalid; | |
| 11175 | |||
| 11176 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&extend,f)) |
| 11177 | ✗ | return qe_invalid; | |
| 11178 | |||
| 11179 | 572 | setSprite(sideswimpoundspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11180 | 572 | } | |
| 11181 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 11182 | { | ||
| 11183 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 11184 | ✗ | return qe_invalid; | |
| 11185 | |||
| 11186 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&flip,f)) |
| 11187 | ✗ | return qe_invalid; | |
| 11188 | |||
| 11189 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&extend,f)) |
| 11190 | ✗ | return qe_invalid; | |
| 11191 | |||
| 11192 | 572 | setSprite(sideswimchargespr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11193 | 572 | } | |
| 11194 | 143 | } | |
| 11195 | else | ||
| 11196 | { | ||
| 11197 | ✗ | memset(sideswimslashspr, 0, sizeof(sideswimslashspr)); | |
| 11198 | ✗ | memset(sideswimstabspr, 0, sizeof(sideswimstabspr)); | |
| 11199 | ✗ | memset(sideswimpoundspr, 0, sizeof(sideswimpoundspr)); | |
| 11200 | ✗ | memset(sideswimchargespr, 0, sizeof(sideswimchargespr)); | |
| 11201 | } | ||
| 11202 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if (v_herosprites > 10) |
| 11203 | { | ||
| 11204 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 11205 | { | ||
| 11206 | int32_t hmr; | ||
| 11207 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_igetl(&hmr,f)) |
| 11208 | ✗ | return qe_invalid; | |
| 11209 | |||
| 11210 | 572 | hammeroffsets[q] = hmr; | |
| 11211 | 572 | } | |
| 11212 | 143 | } | |
| 11213 | else | ||
| 11214 | { | ||
| 11215 | ✗ | for(int32_t q = 0; q < 4; ++q) hammeroffsets[q] = 0; | |
| 11216 | } | ||
| 11217 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if (v_herosprites > 11) |
| 11218 | { | ||
| 11219 |
2/2✓ Branch 0 taken 429 times.
✓ Branch 1 taken 143 times.
|
572 | for(int32_t q = 0; q < 3; ++q) |
| 11220 | { | ||
| 11221 |
1/2✓ Branch 0 taken 429 times.
✗ Branch 1 not taken.
|
429 | if(!p_igetl(&tile,f)) |
| 11222 | ✗ | return qe_invalid; | |
| 11223 | |||
| 11224 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 429 times.
|
429 | if(!p_getc(&flip,f)) |
| 11225 | ✗ | return qe_invalid; | |
| 11226 | |||
| 11227 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 429 times.
|
429 | if(!p_getc(&extend,f)) |
| 11228 | ✗ | return qe_invalid; | |
| 11229 | |||
| 11230 | 429 | setSprite(sideswimholdspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11231 | 429 | } | |
| 11232 | 143 | } | |
| 11233 | else | ||
| 11234 | { | ||
| 11235 | ✗ | memset(sideswimholdspr, 0, sizeof(sideswimholdspr)); | |
| 11236 | } | ||
| 11237 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if (v_herosprites > 12) |
| 11238 | { | ||
| 11239 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_igetl(&tile,f)) |
| 11240 | ✗ | return qe_invalid; | |
| 11241 | |||
| 11242 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_getc(&flip,f)) |
| 11243 | ✗ | return qe_invalid; | |
| 11244 | |||
| 11245 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_getc(&extend,f)) |
| 11246 | ✗ | return qe_invalid; | |
| 11247 | 143 | setSprite(sideswimcastingspr, int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11248 | |||
| 11249 | 143 | } | |
| 11250 | else | ||
| 11251 | { | ||
| 11252 | ✗ | memset(sideswimcastingspr, 0, sizeof(sideswimcastingspr)); | |
| 11253 | } | ||
| 11254 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if (v_herosprites > 13) |
| 11255 | { | ||
| 11256 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 11257 | { | ||
| 11258 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 11259 | ✗ | return qe_invalid; | |
| 11260 | |||
| 11261 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&flip,f)) |
| 11262 | ✗ | return qe_invalid; | |
| 11263 | |||
| 11264 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&extend,f)) |
| 11265 | ✗ | return qe_invalid; | |
| 11266 | |||
| 11267 | 572 | setSprite(sidedrowningspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11268 | 572 | } | |
| 11269 | 143 | } | |
| 11270 | else | ||
| 11271 | { | ||
| 11272 | ✗ | memset(sidedrowningspr, 0, sizeof(sidedrowningspr)); | |
| 11273 | } | ||
| 11274 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if (v_herosprites > 14) |
| 11275 | { | ||
| 11276 |
2/2✓ Branch 0 taken 572 times.
✓ Branch 1 taken 143 times.
|
715 | for(int32_t q = 0; q < 4; ++q) |
| 11277 | { | ||
| 11278 |
1/2✓ Branch 0 taken 572 times.
✗ Branch 1 not taken.
|
572 | if(!p_igetl(&tile,f)) |
| 11279 | ✗ | return qe_invalid; | |
| 11280 | |||
| 11281 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&flip,f)) |
| 11282 | ✗ | return qe_invalid; | |
| 11283 | |||
| 11284 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 572 times.
|
572 | if(!p_getc(&extend,f)) |
| 11285 | ✗ | return qe_invalid; | |
| 11286 | |||
| 11287 | 572 | setSprite(revslashspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11288 | 572 | } | |
| 11289 | 143 | } | |
| 11290 | else | ||
| 11291 | { | ||
| 11292 | ✗ | memset(revslashspr, 0, sizeof(revslashspr)); | |
| 11293 | } | ||
| 11294 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if (v_herosprites > 7) |
| 11295 | { | ||
| 11296 | 143 | int32_t num_defense = wMax; | |
| 11297 | 143 | byte def = 0; | |
| 11298 | |||
| 11299 | //Set num_defense accordingly if changes to enum require version upgrade - Jman | ||
| 11300 | /*if(v_herosprites > [x]) | ||
| 11301 | * { | ||
| 11302 | * num_defense = 146 //value of wMax on version 8 | ||
| 11303 | * } | ||
| 11304 | */ | ||
| 11305 | |||
| 11306 |
2/2✓ Branch 0 taken 20878 times.
✓ Branch 1 taken 143 times.
|
21021 | for (int32_t q = 0; q < num_defense; q++) |
| 11307 | { | ||
| 11308 |
1/2✓ Branch 0 taken 20878 times.
✗ Branch 1 not taken.
|
20878 | if (!p_getc(&def, f)) |
| 11309 | ✗ | return qe_invalid; | |
| 11310 | |||
| 11311 | 20878 | hero_defence[q] = def; | |
| 11312 | 20878 | } | |
| 11313 | 143 | } | |
| 11314 | else | ||
| 11315 | { | ||
| 11316 | ✗ | int32_t num_defense = wMax; | |
| 11317 | ✗ | for (int32_t q = 0; q < num_defense; q++) | |
| 11318 | { | ||
| 11319 | ✗ | hero_defence[q] = 0; | |
| 11320 | ✗ | } | |
| 11321 | } | ||
| 11322 | 143 | } | |
| 11323 | |||
| 11324 |
2/2✓ Branch 0 taken 132 times.
✓ Branch 1 taken 11 times.
|
143 | if(FFCore.quest_format[vInitData] < 34) |
| 11325 | { | ||
| 11326 | 11 | bool fastswim = zinit.hero_swim_speed > 60; | |
| 11327 | // '2/3' or '1/2' | ||
| 11328 | 11 | zinit.hero_swim_mult = fastswim ? 2 : 1; | |
| 11329 | 11 | zinit.hero_swim_div = fastswim ? 3 : 2; | |
| 11330 | 11 | } | |
| 11331 | 143 | return 0; | |
| 11332 | 143 | } | |
| 11333 | |||
| 11334 | |||
| 11335 | 332 | int32_t readherosprites(PACKFILE *f, zquestheader *Header) | |
| 11336 | { | ||
| 11337 | //these are here to bypass compiler warnings about unused arguments | ||
| 11338 | 332 | Header=Header; | |
| 11339 | |||
| 11340 | dword dummy; | ||
| 11341 | 332 | word s_version=0, s_cversion=0; | |
| 11342 | |||
| 11343 | //section version info | ||
| 11344 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | if(!p_igetw(&s_version,f)) |
| 11345 | { | ||
| 11346 | ✗ | return qe_invalid; | |
| 11347 | } | ||
| 11348 | |||
| 11349 | 332 | FFCore.quest_format[vHeroSprites] = s_version; | |
| 11350 | |||
| 11351 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_igetw(&s_cversion,f)) |
| 11352 | { | ||
| 11353 | ✗ | return qe_invalid; | |
| 11354 | } | ||
| 11355 | |||
| 11356 | //section size | ||
| 11357 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_igetl(&dummy,f)) |
| 11358 | { | ||
| 11359 | ✗ | return qe_invalid; | |
| 11360 | } | ||
| 11361 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 189 times.
|
332 | if ( s_version >= 6 ) |
| 11362 | { | ||
| 11363 | 143 | return readherosprites3(f, s_version, dummy); | |
| 11364 | } | ||
| 11365 | 189 | else return readherosprites2(f, s_version, dummy); | |
| 11366 | 332 | } | |
| 11367 | |||
| 11368 | 206 | int32_t read_old_subscreens(PACKFILE *f, word s_version) | |
| 11369 | { | ||
| 11370 | 206 | subscreens_active.clear(); | |
| 11371 | 206 | subscreens_passive.clear(); | |
| 11372 | 206 | subscreens_overlay.clear(); | |
| 11373 |
2/2✓ Branch 0 taken 26368 times.
✓ Branch 1 taken 206 times.
|
26574 | for(int32_t i=0; i<MAXCUSTOMSUBSCREENS; i++) |
| 11374 | { | ||
| 11375 | subscreen_group g; | ||
| 11376 | 26368 | memset(&g,0,sizeof(subscreen_group)); | |
| 11377 | 26368 | int32_t ret = read_one_old_subscreen(f, &g, s_version); | |
| 11378 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26368 times.
|
26368 | if(ret!=0) |
| 11379 | ✗ | return ret; | |
| 11380 |
2/2✓ Branch 0 taken 1066 times.
✓ Branch 1 taken 25302 times.
|
26368 | if(g.objects[0].type == ssoNULL) continue; |
| 11381 |
2/2✓ Branch 0 taken 446 times.
✓ Branch 1 taken 620 times.
|
1066 | auto& vec = g.ss_type == sstPASSIVE ? subscreens_passive : subscreens_active; |
| 11382 | 1066 | ZCSubscreen& sub = vec.emplace_back(); | |
| 11383 | 1066 | sub.load_old(g); | |
| 11384 | 1066 | } | |
| 11385 | |||
| 11386 | 206 | return 0; | |
| 11387 | 206 | } | |
| 11388 | |||
| 11389 | 26368 | int32_t read_one_old_subscreen(PACKFILE *f, subscreen_group* g, word s_version) | |
| 11390 | { | ||
| 11391 | 26368 | int32_t numsub=0; | |
| 11392 | 26368 | byte temp_ss=0; | |
| 11393 | subscreen_object temp_sub_stack; | ||
| 11394 | 26368 | subscreen_object *temp_sub = &temp_sub_stack; | |
| 11395 | |||
| 11396 | char tempname[64]; | ||
| 11397 | |||
| 11398 | // FWIW I never saw anything bigger than 20. | ||
| 11399 | #define MAX_DP1_LEN 1024 | ||
| 11400 | char tempdp1[MAX_DP1_LEN]; | ||
| 11401 | |||
| 11402 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26368 times.
|
26368 | if(!pfread(tempname,64,f)) |
| 11403 | { | ||
| 11404 | ✗ | return qe_invalid; | |
| 11405 | } | ||
| 11406 | |||
| 11407 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26368 times.
|
26368 | if(s_version > 1) |
| 11408 | { | ||
| 11409 |
1/2✓ Branch 0 taken 26368 times.
✗ Branch 1 not taken.
|
26368 | if(!p_getc(&temp_ss,f)) |
| 11410 | { | ||
| 11411 | ✗ | return qe_invalid; | |
| 11412 | } | ||
| 11413 | 26368 | } | |
| 11414 | |||
| 11415 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26368 times.
|
26368 | if(s_version < 4) |
| 11416 | { | ||
| 11417 | ✗ | uint8_t tmp=0; | |
| 11418 | |||
| 11419 | ✗ | if(!p_getc(&tmp,f)) | |
| 11420 | { | ||
| 11421 | ✗ | return qe_invalid; | |
| 11422 | } | ||
| 11423 | |||
| 11424 | ✗ | numsub = (int32_t)tmp; | |
| 11425 | ✗ | } | |
| 11426 | else | ||
| 11427 | { | ||
| 11428 | word tmp; | ||
| 11429 | |||
| 11430 |
1/2✓ Branch 0 taken 26368 times.
✗ Branch 1 not taken.
|
26368 | if(!p_igetw(&tmp, f)) |
| 11431 | { | ||
| 11432 | ✗ | return qe_invalid; | |
| 11433 | } | ||
| 11434 | |||
| 11435 | 26368 | numsub = (int32_t)tmp; | |
| 11436 | } | ||
| 11437 | |||
| 11438 | int32_t j; | ||
| 11439 | |||
| 11440 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 68931 times.
✓ Branch 2 taken 42563 times.
✓ Branch 3 taken 26368 times.
|
68931 | for(j=0; (j<MAXSUBSCREENITEMS&&j<numsub); j++) |
| 11441 | { | ||
| 11442 | 42563 | memset(temp_sub,0,sizeof(subscreen_object)); | |
| 11443 | |||
| 11444 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 42563 times.
|
42563 | switch(g->objects[j].type) |
| 11445 | { | ||
| 11446 | case ssoTEXT: | ||
| 11447 | case ssoTEXTBOX: | ||
| 11448 | case ssoCURRENTITEMTEXT: | ||
| 11449 | case ssoCURRENTITEMCLASSTEXT: | ||
| 11450 | ✗ | if(g->objects[j].dp1 != NULL) delete [](char *)g->objects[j].dp1; | |
| 11451 | |||
| 11452 | //fall through | ||
| 11453 | default: | ||
| 11454 | 42563 | memset(&g->objects[j],0,sizeof(subscreen_object)); | |
| 11455 | 42563 | break; | |
| 11456 | } | ||
| 11457 | |||
| 11458 |
1/2✓ Branch 0 taken 42563 times.
✗ Branch 1 not taken.
|
42563 | if(!p_getc(&(temp_sub->type),f)) |
| 11459 | ✗ | return qe_invalid; | |
| 11460 | |||
| 11461 |
1/2✓ Branch 0 taken 42563 times.
✗ Branch 1 not taken.
|
42563 | if(!p_getc(&(temp_sub->pos),f)) |
| 11462 | ✗ | return qe_invalid; | |
| 11463 | |||
| 11464 |
1/2✓ Branch 0 taken 42563 times.
✗ Branch 1 not taken.
|
42563 | if(s_version < 5) |
| 11465 | { | ||
| 11466 | ✗ | switch(temp_sub->pos) | |
| 11467 | { | ||
| 11468 | case 0: | ||
| 11469 | ✗ | temp_sub->pos = sspUP | sspDOWN | sspSCROLLING; | |
| 11470 | ✗ | break; | |
| 11471 | |||
| 11472 | case 1: | ||
| 11473 | ✗ | temp_sub->pos = sspUP; | |
| 11474 | ✗ | break; | |
| 11475 | |||
| 11476 | case 2: | ||
| 11477 | ✗ | temp_sub->pos = sspDOWN; | |
| 11478 | ✗ | break; | |
| 11479 | |||
| 11480 | default: | ||
| 11481 | ✗ | temp_sub->pos = 0; | |
| 11482 | ✗ | } | |
| 11483 | ✗ | } | |
| 11484 | |||
| 11485 |
1/2✓ Branch 0 taken 42563 times.
✗ Branch 1 not taken.
|
42563 | if(!p_igetw(&(temp_sub->x),f)) |
| 11486 | ✗ | return qe_invalid; | |
| 11487 | |||
| 11488 |
1/2✓ Branch 0 taken 42563 times.
✗ Branch 1 not taken.
|
42563 | if(!p_igetw(&(temp_sub->y),f)) |
| 11489 | ✗ | return qe_invalid; | |
| 11490 | |||
| 11491 |
1/2✓ Branch 0 taken 42563 times.
✗ Branch 1 not taken.
|
42563 | if(!p_igetw(&(temp_sub->w),f)) |
| 11492 | ✗ | return qe_invalid; | |
| 11493 | |||
| 11494 |
1/2✓ Branch 0 taken 42563 times.
✗ Branch 1 not taken.
|
42563 | if(!p_igetw(&(temp_sub->h),f)) |
| 11495 | ✗ | return qe_invalid; | |
| 11496 | |||
| 11497 |
1/2✓ Branch 0 taken 42563 times.
✗ Branch 1 not taken.
|
42563 | if(!p_getc(&(temp_sub->colortype1),f)) |
| 11498 | ✗ | return qe_invalid; | |
| 11499 | |||
| 11500 |
1/2✓ Branch 0 taken 42563 times.
✗ Branch 1 not taken.
|
42563 | if(!p_igetw(&(temp_sub->color1),f)) |
| 11501 | ✗ | return qe_invalid; | |
| 11502 | |||
| 11503 |
1/2✓ Branch 0 taken 42563 times.
✗ Branch 1 not taken.
|
42563 | if(!p_getc(&(temp_sub->colortype2),f)) |
| 11504 | ✗ | return qe_invalid; | |
| 11505 | |||
| 11506 |
1/2✓ Branch 0 taken 42563 times.
✗ Branch 1 not taken.
|
42563 | if(!p_igetw(&(temp_sub->color2),f)) |
| 11507 | ✗ | return qe_invalid; | |
| 11508 | |||
| 11509 |
1/2✓ Branch 0 taken 42563 times.
✗ Branch 1 not taken.
|
42563 | if(!p_getc(&(temp_sub->colortype3),f)) |
| 11510 | ✗ | return qe_invalid; | |
| 11511 | |||
| 11512 |
1/2✓ Branch 0 taken 42563 times.
✗ Branch 1 not taken.
|
42563 | if(!p_igetw(&(temp_sub->color3),f)) |
| 11513 | ✗ | return qe_invalid; | |
| 11514 | |||
| 11515 |
1/2✓ Branch 0 taken 42563 times.
✗ Branch 1 not taken.
|
42563 | if(!p_igetd(&(temp_sub->d1),f)) |
| 11516 | ✗ | return qe_invalid; | |
| 11517 | |||
| 11518 |
1/2✓ Branch 0 taken 42563 times.
✗ Branch 1 not taken.
|
42563 | if(!p_igetd(&(temp_sub->d2),f)) |
| 11519 | ✗ | return qe_invalid; | |
| 11520 | |||
| 11521 |
1/2✓ Branch 0 taken 42563 times.
✗ Branch 1 not taken.
|
42563 | if(!p_igetd(&(temp_sub->d3),f)) |
| 11522 | ✗ | return qe_invalid; | |
| 11523 | |||
| 11524 |
1/2✓ Branch 0 taken 42563 times.
✗ Branch 1 not taken.
|
42563 | if(!p_igetd(&(temp_sub->d4),f)) |
| 11525 | ✗ | return qe_invalid; | |
| 11526 | |||
| 11527 |
1/2✓ Branch 0 taken 42563 times.
✗ Branch 1 not taken.
|
42563 | if(!p_igetd(&(temp_sub->d5),f)) |
| 11528 | ✗ | return qe_invalid; | |
| 11529 | |||
| 11530 |
1/2✓ Branch 0 taken 42563 times.
✗ Branch 1 not taken.
|
42563 | if(!p_igetd(&(temp_sub->d6),f)) |
| 11531 | ✗ | return qe_invalid; | |
| 11532 | |||
| 11533 |
1/2✓ Branch 0 taken 42563 times.
✗ Branch 1 not taken.
|
42563 | if(!p_igetd(&(temp_sub->d7),f)) |
| 11534 | ✗ | return qe_invalid; | |
| 11535 | |||
| 11536 |
1/2✓ Branch 0 taken 42563 times.
✗ Branch 1 not taken.
|
42563 | if(!p_igetd(&(temp_sub->d8),f)) |
| 11537 | ✗ | return qe_invalid; | |
| 11538 | |||
| 11539 |
1/2✓ Branch 0 taken 42563 times.
✗ Branch 1 not taken.
|
42563 | if(!p_igetd(&(temp_sub->d9),f)) |
| 11540 | ✗ | return qe_invalid; | |
| 11541 | |||
| 11542 |
1/2✓ Branch 0 taken 42563 times.
✗ Branch 1 not taken.
|
42563 | if(!p_igetd(&(temp_sub->d10),f)) |
| 11543 | ✗ | return qe_invalid; | |
| 11544 | |||
| 11545 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 42563 times.
|
42563 | if(s_version < 2) |
| 11546 | { | ||
| 11547 | ✗ | if(!p_igetl(&(temp_sub->speed),f)) | |
| 11548 | ✗ | return qe_invalid; | |
| 11549 | |||
| 11550 | ✗ | if(!p_igetl(&(temp_sub->delay),f)) | |
| 11551 | ✗ | return qe_invalid; | |
| 11552 | |||
| 11553 | ✗ | if(!p_igetl(&(temp_sub->frame),f)) | |
| 11554 | ✗ | return qe_invalid; | |
| 11555 | ✗ | } | |
| 11556 | else | ||
| 11557 | { | ||
| 11558 |
1/2✓ Branch 0 taken 42563 times.
✗ Branch 1 not taken.
|
42563 | if(!p_getc(&(temp_sub->speed),f)) |
| 11559 | ✗ | return qe_invalid; | |
| 11560 | |||
| 11561 |
1/2✓ Branch 0 taken 42563 times.
✗ Branch 1 not taken.
|
42563 | if(!p_getc(&(temp_sub->delay),f)) |
| 11562 | ✗ | return qe_invalid; | |
| 11563 | |||
| 11564 |
1/2✓ Branch 0 taken 42563 times.
✗ Branch 1 not taken.
|
42563 | if(!p_igetw(&(temp_sub->frame),f)) |
| 11565 | ✗ | return qe_invalid; | |
| 11566 | } | ||
| 11567 | |||
| 11568 | 42563 | int32_t temp_size=0; | |
| 11569 | |||
| 11570 | // bool deletets = false; | ||
| 11571 |
4/4✓ Branch 0 taken 18777 times.
✓ Branch 1 taken 3226 times.
✓ Branch 2 taken 20344 times.
✓ Branch 3 taken 216 times.
|
42563 | switch(temp_sub->type) |
| 11572 | { | ||
| 11573 | case ssoTEXT: | ||
| 11574 | case ssoTEXTBOX: | ||
| 11575 | case ssoCURRENTITEMTEXT: | ||
| 11576 | case ssoCURRENTITEMCLASSTEXT: | ||
| 11577 | { | ||
| 11578 | word temptempsize; | ||
| 11579 | |||
| 11580 |
1/2✓ Branch 0 taken 3226 times.
✗ Branch 1 not taken.
|
3226 | if(!p_igetw(&temptempsize,f)) |
| 11581 | { | ||
| 11582 | ✗ | return qe_invalid; | |
| 11583 | } | ||
| 11584 | |||
| 11585 | //temptempsize = temp1 + (temp2 << 8); | ||
| 11586 | 3226 | temp_size = (int32_t)temptempsize; | |
| 11587 | 3226 | uint32_t char_length = temp_size+2; | |
| 11588 |
1/2✓ Branch 0 taken 3226 times.
✗ Branch 1 not taken.
|
3226 | if (char_length > MAX_DP1_LEN) |
| 11589 | { | ||
| 11590 | ✗ | return qe_invalid; | |
| 11591 | } | ||
| 11592 | 3226 | tempdp1[char_length - 1] = '\0'; | |
| 11593 | |||
| 11594 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3226 times.
|
3226 | if(temp_size) |
| 11595 |
1/2✓ Branch 0 taken 3226 times.
✗ Branch 1 not taken.
|
3226 | if(!pfread(tempdp1,temp_size+1,f)) |
| 11596 | ✗ | return qe_invalid; | |
| 11597 | 3226 | break; | |
| 11598 | } | ||
| 11599 | |||
| 11600 | case ssoLIFEMETER: | ||
| 11601 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(get_bit(deprecated_rules, 12) != 0) // qr_24HC |
| 11602 | ✗ | temp_sub->d3 = 1; | |
| 11603 | |||
| 11604 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(!p_getc(&(temp_sub->dp1),f)) |
| 11605 | ✗ | return qe_invalid; | |
| 11606 | |||
| 11607 | 216 | break; | |
| 11608 | |||
| 11609 | |||
| 11610 | case ssoCURRENTITEM: | ||
| 11611 | |||
| 11612 |
1/2✓ Branch 0 taken 18777 times.
✗ Branch 1 not taken.
|
18777 | if(s_version < 6) |
| 11613 | { | ||
| 11614 | ✗ | switch(temp_sub->d1) | |
| 11615 | { | ||
| 11616 | case ssiBOMB: | ||
| 11617 | ✗ | temp_sub->d1 = itype_bomb; | |
| 11618 | ✗ | break; | |
| 11619 | |||
| 11620 | case ssiSWORD: | ||
| 11621 | ✗ | temp_sub->d1 = itype_sword; | |
| 11622 | ✗ | break; | |
| 11623 | |||
| 11624 | case ssiSHIELD: | ||
| 11625 | ✗ | temp_sub->d1 = itype_shield; | |
| 11626 | ✗ | break; | |
| 11627 | |||
| 11628 | case ssiCANDLE: | ||
| 11629 | ✗ | temp_sub->d1 = itype_candle; | |
| 11630 | ✗ | break; | |
| 11631 | |||
| 11632 | case ssiLETTER: | ||
| 11633 | ✗ | temp_sub->d1 = itype_letter; | |
| 11634 | ✗ | break; | |
| 11635 | |||
| 11636 | case ssiPOTION: | ||
| 11637 | ✗ | temp_sub->d1 = itype_potion; | |
| 11638 | ✗ | break; | |
| 11639 | |||
| 11640 | case ssiLETTERPOTION: | ||
| 11641 | ✗ | temp_sub->d1 = itype_letterpotion; | |
| 11642 | ✗ | break; | |
| 11643 | |||
| 11644 | case ssiBOW: | ||
| 11645 | ✗ | temp_sub->d1 = itype_bow; | |
| 11646 | ✗ | break; | |
| 11647 | |||
| 11648 | case ssiARROW: | ||
| 11649 | ✗ | temp_sub->d1 = itype_arrow; | |
| 11650 | ✗ | break; | |
| 11651 | |||
| 11652 | case ssiBOWANDARROW: | ||
| 11653 | ✗ | temp_sub->d1 = itype_bowandarrow; | |
| 11654 | ✗ | break; | |
| 11655 | |||
| 11656 | case ssiBAIT: | ||
| 11657 | ✗ | temp_sub->d1 = itype_bait; | |
| 11658 | ✗ | break; | |
| 11659 | |||
| 11660 | case ssiRING: | ||
| 11661 | ✗ | temp_sub->d1 = itype_ring; | |
| 11662 | ✗ | break; | |
| 11663 | |||
| 11664 | case ssiBRACELET: | ||
| 11665 | ✗ | temp_sub->d1 = itype_bracelet; | |
| 11666 | ✗ | break; | |
| 11667 | |||
| 11668 | case ssiMAP: | ||
| 11669 | ✗ | temp_sub->d1 = itype_map; | |
| 11670 | ✗ | break; | |
| 11671 | |||
| 11672 | case ssiCOMPASS: | ||
| 11673 | ✗ | temp_sub->d1 = itype_compass; | |
| 11674 | ✗ | break; | |
| 11675 | |||
| 11676 | case ssiBOSSKEY: | ||
| 11677 | ✗ | temp_sub->d1 = itype_bosskey; | |
| 11678 | ✗ | break; | |
| 11679 | |||
| 11680 | case ssiMAGICKEY: | ||
| 11681 | ✗ | temp_sub->d1 = itype_magickey; | |
| 11682 | ✗ | break; | |
| 11683 | |||
| 11684 | case ssiBRANG: | ||
| 11685 | ✗ | temp_sub->d1 = itype_brang; | |
| 11686 | ✗ | break; | |
| 11687 | |||
| 11688 | case ssiWAND: | ||
| 11689 | ✗ | temp_sub->d1 = itype_wand; | |
| 11690 | ✗ | break; | |
| 11691 | |||
| 11692 | case ssiRAFT: | ||
| 11693 | ✗ | temp_sub->d1 = itype_raft; | |
| 11694 | ✗ | break; | |
| 11695 | |||
| 11696 | case ssiLADDER: | ||
| 11697 | ✗ | temp_sub->d1 = itype_ladder; | |
| 11698 | ✗ | break; | |
| 11699 | |||
| 11700 | case ssiWHISTLE: | ||
| 11701 | ✗ | temp_sub->d1 = itype_whistle; | |
| 11702 | ✗ | break; | |
| 11703 | |||
| 11704 | case ssiBOOK: | ||
| 11705 | ✗ | temp_sub->d1 = itype_book; | |
| 11706 | ✗ | break; | |
| 11707 | |||
| 11708 | case ssiWALLET: | ||
| 11709 | ✗ | temp_sub->d1 = itype_wallet; | |
| 11710 | ✗ | break; | |
| 11711 | |||
| 11712 | case ssiSBOMB: | ||
| 11713 | ✗ | temp_sub->d1 = itype_sbomb; | |
| 11714 | ✗ | break; | |
| 11715 | |||
| 11716 | case ssiHCPIECE: | ||
| 11717 | ✗ | temp_sub->d1 = itype_heartpiece; | |
| 11718 | ✗ | break; | |
| 11719 | |||
| 11720 | case ssiAMULET: | ||
| 11721 | ✗ | temp_sub->d1 = itype_amulet; | |
| 11722 | ✗ | break; | |
| 11723 | |||
| 11724 | case ssiFLIPPERS: | ||
| 11725 | ✗ | temp_sub->d1 = itype_flippers; | |
| 11726 | ✗ | break; | |
| 11727 | |||
| 11728 | case ssiHOOKSHOT: | ||
| 11729 | ✗ | temp_sub->d1 = itype_hookshot; | |
| 11730 | ✗ | break; | |
| 11731 | |||
| 11732 | case ssiLENS: | ||
| 11733 | ✗ | temp_sub->d1 = itype_lens; | |
| 11734 | ✗ | break; | |
| 11735 | |||
| 11736 | case ssiHAMMER: | ||
| 11737 | ✗ | temp_sub->d1 = itype_hammer; | |
| 11738 | ✗ | break; | |
| 11739 | |||
| 11740 | case ssiBOOTS: | ||
| 11741 | ✗ | temp_sub->d1 = itype_boots; | |
| 11742 | ✗ | break; | |
| 11743 | |||
| 11744 | case ssiDIVINEFIRE: | ||
| 11745 | ✗ | temp_sub->d1 = itype_divinefire; | |
| 11746 | ✗ | break; | |
| 11747 | |||
| 11748 | case ssiDIVINEESCAPE: | ||
| 11749 | ✗ | temp_sub->d1 = itype_divineescape; | |
| 11750 | ✗ | break; | |
| 11751 | |||
| 11752 | case ssiDIVINEPROTECTION: | ||
| 11753 | ✗ | temp_sub->d1 = itype_divineprotection; | |
| 11754 | ✗ | break; | |
| 11755 | |||
| 11756 | case ssiQUIVER: | ||
| 11757 | ✗ | temp_sub->d1 = itype_quiver; | |
| 11758 | ✗ | break; | |
| 11759 | |||
| 11760 | case ssiBOMBBAG: | ||
| 11761 | ✗ | temp_sub->d1 = itype_bombbag; | |
| 11762 | ✗ | break; | |
| 11763 | |||
| 11764 | case ssiCBYRNA: | ||
| 11765 | ✗ | temp_sub->d1 = itype_cbyrna; | |
| 11766 | ✗ | break; | |
| 11767 | |||
| 11768 | case ssiROCS: | ||
| 11769 | ✗ | temp_sub->d1 = itype_rocs; | |
| 11770 | ✗ | break; | |
| 11771 | |||
| 11772 | case ssiHOVERBOOTS: | ||
| 11773 | ✗ | temp_sub->d1 = itype_hoverboots; | |
| 11774 | ✗ | break; | |
| 11775 | |||
| 11776 | case ssiSPINSCROLL: | ||
| 11777 | ✗ | temp_sub->d1 = itype_spinscroll; | |
| 11778 | ✗ | break; | |
| 11779 | |||
| 11780 | case ssiCROSSSCROLL: | ||
| 11781 | ✗ | temp_sub->d1 = itype_crossscroll; | |
| 11782 | ✗ | break; | |
| 11783 | |||
| 11784 | case ssiQUAKESCROLL: | ||
| 11785 | ✗ | temp_sub->d1 = itype_quakescroll; | |
| 11786 | ✗ | break; | |
| 11787 | |||
| 11788 | case ssiWHISPRING: | ||
| 11789 | ✗ | temp_sub->d1 = itype_whispring; | |
| 11790 | ✗ | break; | |
| 11791 | |||
| 11792 | case ssiCHARGERING: | ||
| 11793 | ✗ | temp_sub->d1 = itype_chargering; | |
| 11794 | ✗ | break; | |
| 11795 | |||
| 11796 | case ssiPERILSCROLL: | ||
| 11797 | ✗ | temp_sub->d1 = itype_perilscroll; | |
| 11798 | ✗ | break; | |
| 11799 | |||
| 11800 | case ssiWEALTHMEDAL: | ||
| 11801 | ✗ | temp_sub->d1 = itype_wealthmedal; | |
| 11802 | ✗ | break; | |
| 11803 | |||
| 11804 | case ssiHEARTRING: | ||
| 11805 | ✗ | temp_sub->d1 = itype_heartring; | |
| 11806 | ✗ | break; | |
| 11807 | |||
| 11808 | case ssiMAGICRING: | ||
| 11809 | ✗ | temp_sub->d1 = itype_magicring; | |
| 11810 | ✗ | break; | |
| 11811 | |||
| 11812 | case ssiSPINSCROLL2: | ||
| 11813 | ✗ | temp_sub->d1 = itype_spinscroll2; | |
| 11814 | ✗ | break; | |
| 11815 | |||
| 11816 | case ssiQUAKESCROLL2: | ||
| 11817 | ✗ | temp_sub->d1 = itype_quakescroll2; | |
| 11818 | ✗ | break; | |
| 11819 | |||
| 11820 | case ssiAGONY: | ||
| 11821 | ✗ | temp_sub->d1 = itype_agony; | |
| 11822 | ✗ | break; | |
| 11823 | |||
| 11824 | case ssiSTOMPBOOTS: | ||
| 11825 | ✗ | temp_sub->d1 = itype_stompboots; | |
| 11826 | ✗ | break; | |
| 11827 | |||
| 11828 | case ssiWHIMSICALRING: | ||
| 11829 | ✗ | temp_sub->d1 = itype_whimsicalring; | |
| 11830 | ✗ | break; | |
| 11831 | |||
| 11832 | case ssiPERILRING: | ||
| 11833 | ✗ | temp_sub->d1 = itype_perilring; | |
| 11834 | ✗ | break; | |
| 11835 | |||
| 11836 | default: | ||
| 11837 | ✗ | temp_sub->d1 += itype_custom1 - ssiMAX; | |
| 11838 | ✗ | } | |
| 11839 | ✗ | } | |
| 11840 | |||
| 11841 | //fall-through | ||
| 11842 | default: | ||
| 11843 |
1/2✓ Branch 0 taken 39121 times.
✗ Branch 1 not taken.
|
39121 | if(!p_getc(&(temp_sub->dp1),f)) |
| 11844 | ✗ | return qe_invalid; | |
| 11845 | |||
| 11846 | 39121 | break; | |
| 11847 | } | ||
| 11848 | |||
| 11849 |
2/2✓ Branch 0 taken 8694 times.
✓ Branch 1 taken 33869 times.
|
42563 | if(s_version < 7) |
| 11850 | { | ||
| 11851 |
3/3✓ Branch 0 taken 27879 times.
✓ Branch 1 taken 1366 times.
✓ Branch 2 taken 4624 times.
|
33869 | switch(temp_sub->type) |
| 11852 | { | ||
| 11853 | case ssoMAGICGAUGE: | ||
| 11854 | { | ||
| 11855 |
2/2✓ Branch 0 taken 118 times.
✓ Branch 1 taken 1248 times.
|
1366 | if(!temp_sub->d9) |
| 11856 | 1248 | temp_sub->d9 = -1; //-1 now represents 'always' | |
| 11857 | 1366 | break; | |
| 11858 | } | ||
| 11859 | case ssoLIFEGAUGE: | ||
| 11860 | 4624 | temp_sub->d9 = 0; //Unused, doesn't do anything? Clear it... | |
| 11861 | 4624 | break; | |
| 11862 | } | ||
| 11863 | 33869 | } | |
| 11864 | |||
| 11865 |
3/3✓ Branch 0 taken 3226 times.
✓ Branch 1 taken 37865 times.
✓ Branch 2 taken 1472 times.
|
42563 | switch(temp_sub->type) |
| 11866 | { | ||
| 11867 | case ssoTEXT: | ||
| 11868 | case ssoTEXTBOX: | ||
| 11869 | case ssoCURRENTITEMTEXT: | ||
| 11870 | case ssoCURRENTITEMCLASSTEXT: | ||
| 11871 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 3226 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
3226 | if(g->objects[j].dp1 != NULL) delete[](char *)g->objects[j].dp1; |
| 11872 | |||
| 11873 | 3226 | memcpy(&g->objects[j],temp_sub,sizeof(subscreen_object)); | |
| 11874 | 3226 | g->objects[j].dp1 = new char[temp_size+2]; | |
| 11875 | 3226 | strcpy((char*)g->objects[j].dp1,tempdp1); | |
| 11876 | 3226 | break; | |
| 11877 | |||
| 11878 | case ssoCOUNTER: | ||
| 11879 |
1/2✓ Branch 0 taken 1472 times.
✗ Branch 1 not taken.
|
1472 | if(s_version<3) |
| 11880 | { | ||
| 11881 | ✗ | temp_sub->d6=(temp_sub->d6?1:0)+(temp_sub->d8?2:0); | |
| 11882 | ✗ | temp_sub->d8=0; | |
| 11883 | ✗ | } | |
| 11884 | |||
| 11885 | default: | ||
| 11886 | 39337 | memcpy(&g->objects[j],temp_sub,sizeof(subscreen_object)); | |
| 11887 | 39337 | break; | |
| 11888 | } | ||
| 11889 | |||
| 11890 | 42563 | g->name[0] = '\0'; | |
| 11891 | 42563 | strncat(g->name, tempname, 64 - 1); | |
| 11892 | 42563 | g->ss_type = temp_ss; | |
| 11893 | 42563 | } | |
| 11894 | |||
| 11895 |
2/2✓ Branch 0 taken 6707645 times.
✓ Branch 1 taken 26368 times.
|
6734013 | for(j=numsub; j<MAXSUBSCREENITEMS; j++) |
| 11896 | { | ||
| 11897 | //clear all unused object in this subscreen -DD | ||
| 11898 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6707645 times.
|
6707645 | switch(g->objects[j].type) |
| 11899 | { | ||
| 11900 | case ssoTEXT: | ||
| 11901 | case ssoTEXTBOX: | ||
| 11902 | case ssoCURRENTITEMTEXT: | ||
| 11903 | case ssoCURRENTITEMCLASSTEXT: | ||
| 11904 | ✗ | if(g->objects[j].dp1 != NULL) delete [](char *)g->objects[j].dp1; | |
| 11905 | |||
| 11906 | //fall through | ||
| 11907 | default: | ||
| 11908 | 6707645 | memset(&g->objects[j],0,sizeof(subscreen_object)); | |
| 11909 | 6707645 | break; | |
| 11910 | } | ||
| 11911 | 6707645 | } | |
| 11912 | |||
| 11913 | 26368 | return 0; | |
| 11914 | 26368 | } | |
| 11915 | |||
| 11916 | 332 | int32_t readsubscreens(PACKFILE *f) | |
| 11917 | { | ||
| 11918 | word s_version, s_cversion; | ||
| 11919 | dword dummy; | ||
| 11920 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | if(!p_igetw(&s_version,f)) |
| 11921 | ✗ | return qe_invalid; | |
| 11922 | 332 | FFCore.quest_format[vSubscreen] = s_version; | |
| 11923 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_igetw(&s_cversion,f)) |
| 11924 | ✗ | return qe_invalid; | |
| 11925 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_igetl(&dummy,f)) //section size |
| 11926 | ✗ | return qe_invalid; | |
| 11927 | |||
| 11928 |
2/2✓ Branch 0 taken 206 times.
✓ Branch 1 taken 126 times.
|
332 | if(s_version < 8) |
| 11929 | 206 | return read_old_subscreens(f,s_version); | |
| 11930 | |||
| 11931 | 126 | subscreens_active.clear(); | |
| 11932 | 126 | subscreens_passive.clear(); | |
| 11933 | 126 | subscreens_overlay.clear(); | |
| 11934 | |||
| 11935 | byte sz; | ||
| 11936 |
1/2✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
|
126 | if(!p_getc(&sz,f)) |
| 11937 | ✗ | return qe_invalid; | |
| 11938 |
2/2✓ Branch 0 taken 486 times.
✓ Branch 1 taken 126 times.
|
612 | for(byte q = 0; q < sz; ++q) |
| 11939 | { | ||
| 11940 | 486 | ZCSubscreen& tmp = subscreens_active.emplace_back(); | |
| 11941 |
1/2✓ Branch 0 taken 486 times.
✗ Branch 1 not taken.
|
486 | if (auto ret = tmp.read(f, s_version)) |
| 11942 | ✗ | return ret; | |
| 11943 | 486 | } | |
| 11944 |
1/2✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
|
126 | if(!p_getc(&sz,f)) |
| 11945 | ✗ | return qe_invalid; | |
| 11946 |
2/2✓ Branch 0 taken 468 times.
✓ Branch 1 taken 126 times.
|
594 | for(byte q = 0; q < sz; ++q) |
| 11947 | { | ||
| 11948 | 468 | ZCSubscreen& tmp = subscreens_passive.emplace_back(); | |
| 11949 |
1/2✓ Branch 0 taken 468 times.
✗ Branch 1 not taken.
|
468 | if (auto ret = tmp.read(f, s_version)) |
| 11950 | ✗ | return ret; | |
| 11951 | 468 | } | |
| 11952 |
1/2✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
|
126 | if(!p_getc(&sz,f)) |
| 11953 | ✗ | return qe_invalid; | |
| 11954 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 126 times.
|
128 | for(byte q = 0; q < sz; ++q) |
| 11955 | { | ||
| 11956 | 2 | ZCSubscreen& tmp = subscreens_overlay.emplace_back(); | |
| 11957 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (auto ret = tmp.read(f, s_version)) |
| 11958 | ✗ | return ret; | |
| 11959 | 2 | } | |
| 11960 | 126 | return 0; | |
| 11961 | 332 | } | |
| 11962 | |||
| 11963 | ✗ | void reset_subscreen(subscreen_group *tempss) | |
| 11964 | { | ||
| 11965 | ✗ | for(int32_t i=0; i<MAXSUBSCREENITEMS; ++i) | |
| 11966 | { | ||
| 11967 | ✗ | switch(tempss->objects[i].type) | |
| 11968 | { | ||
| 11969 | case ssoTEXT: | ||
| 11970 | case ssoTEXTBOX: | ||
| 11971 | case ssoCURRENTITEMTEXT: | ||
| 11972 | case ssoCURRENTITEMCLASSTEXT: | ||
| 11973 | ✗ | if(tempss->objects[i].dp1 != NULL) delete [](char *)tempss->objects[i].dp1; | |
| 11974 | |||
| 11975 | //fall through | ||
| 11976 | default: | ||
| 11977 | ✗ | memset(&tempss->objects[i],0,sizeof(subscreen_object)); | |
| 11978 | ✗ | break; | |
| 11979 | } | ||
| 11980 | ✗ | } | |
| 11981 | ✗ | } | |
| 11982 | |||
| 11983 | 107 | void reset_subscreens() | |
| 11984 | { | ||
| 11985 | 107 | subscreens_active.clear(); | |
| 11986 | 107 | subscreens_passive.clear(); | |
| 11987 | 107 | subscreens_overlay.clear(); | |
| 11988 | 107 | } | |
| 11989 | |||
| 11990 | 107 | int32_t setupsubscreens() | |
| 11991 | { | ||
| 11992 | 107 | reset_subscreens(); | |
| 11993 | //return 0; | ||
| 11994 |
2/2✓ Branch 0 taken 107 times.
✓ Branch 1 taken 214 times.
|
321 | for(int q = 0; q < 2; ++q) |
| 11995 | { | ||
| 11996 | 214 | subscreens_active.emplace_back(); | |
| 11997 | 214 | subscreens_passive.emplace_back(); | |
| 11998 | 214 | } | |
| 11999 | 107 | int32_t tempsubscreen=subscr_mode; | |
| 12000 | |||
| 12001 |
1/2✓ Branch 0 taken 107 times.
✗ Branch 1 not taken.
|
107 | if(tempsubscreen>=ssdtMAX) |
| 12002 | ✗ | tempsubscreen=0; | |
| 12003 | |||
| 12004 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 107 times.
✗ Branch 2 not taken.
|
107 | switch(tempsubscreen) |
| 12005 | { | ||
| 12006 | case ssdtOLD: | ||
| 12007 | case ssdtNEWSUBSCR: | ||
| 12008 | case ssdtREV2: | ||
| 12009 | case ssdtBSZELDA: | ||
| 12010 | case ssdtBSZELDAMODIFIED: | ||
| 12011 | case ssdtBSZELDAENHANCED: | ||
| 12012 | case ssdtBSZELDACOMPLETE: | ||
| 12013 | { | ||
| 12014 | 107 | subscreens_active[0].load_old(default_subscreen_active[tempsubscreen][0]); | |
| 12015 | 107 | subscreens_active[0].sub_type=sstACTIVE; | |
| 12016 | 107 | subscreens_active[0].name = "Active Subscreen (Triforce)"; | |
| 12017 | 107 | subscreens_active[1].load_old(default_subscreen_active[tempsubscreen][1]); | |
| 12018 | 107 | subscreens_active[1].sub_type=sstACTIVE; | |
| 12019 | 107 | subscreens_active[1].name = "Active Subscreen (Dungeon Map)"; | |
| 12020 | 107 | subscreens_passive[0].load_old(default_subscreen_passive[tempsubscreen][0]); | |
| 12021 | 107 | subscreens_passive[0].sub_type=sstPASSIVE; | |
| 12022 | 107 | subscreens_passive[0].name = "Passive Subscreen (Magic)"; | |
| 12023 | 107 | subscreens_passive[1].load_old(default_subscreen_passive[tempsubscreen][1]); | |
| 12024 | 107 | subscreens_passive[1].sub_type=sstPASSIVE; | |
| 12025 | 107 | subscreens_passive[1].name = "Passive Subscreen (No Magic)"; | |
| 12026 | 107 | break; | |
| 12027 | } | ||
| 12028 | |||
| 12029 | case ssdtZ3: | ||
| 12030 | { | ||
| 12031 | ✗ | subscreens_active[0].load_old(z3_active_a); | |
| 12032 | ✗ | subscreens_active[0].sub_type=sstACTIVE; | |
| 12033 | ✗ | subscreens_active[1].load_old(z3_active_ab); | |
| 12034 | ✗ | subscreens_active[1].sub_type=sstACTIVE; | |
| 12035 | ✗ | subscreens_passive[0].load_old(z3_passive_a); | |
| 12036 | ✗ | subscreens_passive[0].sub_type=sstPASSIVE; | |
| 12037 | ✗ | subscreens_passive[1].load_old(z3_passive_ab); | |
| 12038 | ✗ | subscreens_passive[1].sub_type=sstPASSIVE; | |
| 12039 | ✗ | break; | |
| 12040 | } | ||
| 12041 | } | ||
| 12042 | 107 | subscr_mode = ssdtMAX; | |
| 12043 | 107 | return 0; | |
| 12044 | } | ||
| 12045 | |||
| 12046 | extern std::vector<std::shared_ptr<zasm_script>> zasm_scripts; | ||
| 12047 | |||
| 12048 | extern script_data *ffscripts[NUMSCRIPTFFC]; | ||
| 12049 | extern script_data *itemscripts[NUMSCRIPTITEM]; | ||
| 12050 | extern script_data *guyscripts[NUMSCRIPTGUYS]; | ||
| 12051 | extern script_data *lwpnscripts[NUMSCRIPTWEAPONS]; | ||
| 12052 | extern script_data *ewpnscripts[NUMSCRIPTWEAPONS]; | ||
| 12053 | extern script_data *globalscripts[NUMSCRIPTGLOBAL]; | ||
| 12054 | extern script_data *genericscripts[NUMSCRIPTSGENERIC]; | ||
| 12055 | extern script_data *playerscripts[NUMSCRIPTPLAYER]; | ||
| 12056 | extern script_data *screenscripts[NUMSCRIPTSCREEN]; | ||
| 12057 | extern script_data *dmapscripts[NUMSCRIPTSDMAP]; | ||
| 12058 | extern script_data *itemspritescripts[NUMSCRIPTSITEMSPRITE]; | ||
| 12059 | extern script_data *comboscripts[NUMSCRIPTSCOMBODATA]; | ||
| 12060 | extern script_data *subscreenscripts[NUMSCRIPTSSUBSCREEN]; | ||
| 12061 | |||
| 12062 | static std::vector<const script_data*> read_scripts; | ||
| 12063 | |||
| 12064 | 372 | int32_t readffscript(PACKFILE *f, zquestheader *Header) | |
| 12065 | { | ||
| 12066 | int32_t dummy; | ||
| 12067 | 372 | word s_version=0, s_cversion=0, zmeta_version=0; | |
| 12068 | 372 | byte numscripts=0; | |
| 12069 | 372 | numscripts=numscripts; //to avoid unused variables warnings | |
| 12070 | int32_t ret; | ||
| 12071 | 372 | read_scripts.clear(); | |
| 12072 | 372 | zasm_scripts.clear(); | |
| 12073 | |||
| 12074 | //section version info | ||
| 12075 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 372 times.
|
372 | if(!p_igetw(&s_version,f)) |
| 12076 | { | ||
| 12077 | ✗ | return qe_invalid; | |
| 12078 | } | ||
| 12079 | |||
| 12080 | 372 | FFCore.quest_format[vFFScript] = s_version; | |
| 12081 | |||
| 12082 |
1/2✓ Branch 0 taken 372 times.
✗ Branch 1 not taken.
|
372 | if(!p_igetw(&s_cversion,f)) |
| 12083 | { | ||
| 12084 | ✗ | return qe_invalid; | |
| 12085 | } | ||
| 12086 | |||
| 12087 |
2/2✓ Branch 0 taken 229 times.
✓ Branch 1 taken 143 times.
|
372 | if(s_version >= 18) |
| 12088 | { | ||
| 12089 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_igetw(&zmeta_version,f)) |
| 12090 | { | ||
| 12091 | ✗ | return qe_invalid; | |
| 12092 | } | ||
| 12093 | 143 | } | |
| 12094 | |||
| 12095 | //section size | ||
| 12096 |
1/2✓ Branch 0 taken 372 times.
✗ Branch 1 not taken.
|
372 | if(!p_igetl(&dummy,f)) |
| 12097 | { | ||
| 12098 | ✗ | return qe_invalid; | |
| 12099 | } | ||
| 12100 | |||
| 12101 |
2/2✓ Branch 0 taken 165 times.
✓ Branch 1 taken 207 times.
|
372 | if ( FFCore.quest_format[vLastCompile] < 13 ) FFCore.quest_format[vLastCompile] = s_version; |
| 12102 | 372 | al_trace("Loaded scripts last compiled in ZScript version: %d\n", (FFCore.quest_format[vLastCompile])); | |
| 12103 | |||
| 12104 | //finally... section data | ||
| 12105 |
2/2✓ Branch 0 taken 169984 times.
✓ Branch 1 taken 272 times.
|
170356 | for(int32_t i = 0; i < ((s_version < 2) ? NUMSCRIPTFFCOLD : NUMSCRIPTFFC); i++) |
| 12106 | { | ||
| 12107 | 169984 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, ffscripts[i], zmeta_version); | |
| 12108 | |||
| 12109 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if (ret) |
| 12110 | { | ||
| 12111 | ✗ | return qe_invalid; | |
| 12112 | } | ||
| 12113 | 169984 | } | |
| 12114 | |||
| 12115 | /* HIGHLY UNORTHODOX UPDATING THING, by Deedee | ||
| 12116 | * This fixes changes to sprite jump values introduced in early 2.55 alphas. | ||
| 12117 | * Zoria didn't bump up the versions as liberally as he should have, but thankfully | ||
| 12118 | * there was a version bump a week before a change that broke stuff. | ||
| 12119 | */ | ||
| 12120 |
7/8✓ Branch 0 taken 143 times.
✓ Branch 1 taken 129 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 143 times.
✓ Branch 4 taken 143 times.
✓ Branch 5 taken 143 times.
✓ Branch 6 taken 143 times.
✓ Branch 7 taken 143 times.
|
272 | if(((Header->zelda_version < 0x253)||((Header->zelda_version == 0x253)&&(Header->build<33))||((Header->zelda_version > 0x253) && s_version < 12))) |
| 12121 | { | ||
| 12122 | 415 | set_qr(qr_SPRITE_JUMP_IS_TRUNCATED,1); | |
| 12123 | 415 | } | |
| 12124 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 189 times.
|
332 | if(s_version < 19) |
| 12125 | { | ||
| 12126 | 189 | set_qr(qr_FLUCTUATING_ENEMY_JUMP,1); | |
| 12127 | 189 | } | |
| 12128 | |||
| 12129 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | if(s_version > 1) |
| 12130 | { | ||
| 12131 |
2/2✓ Branch 0 taken 84992 times.
✓ Branch 1 taken 332 times.
|
85324 | for(int32_t i = 0; i < NUMSCRIPTITEM; i++) |
| 12132 | { | ||
| 12133 | 84992 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, itemscripts[i], zmeta_version); | |
| 12134 | |||
| 12135 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if (ret) |
| 12136 | { | ||
| 12137 | ✗ | return qe_invalid; | |
| 12138 | } | ||
| 12139 | 84992 | } | |
| 12140 | |||
| 12141 |
2/2✓ Branch 0 taken 84992 times.
✓ Branch 1 taken 332 times.
|
85324 | for(int32_t i = 0; i < NUMSCRIPTGUYS; i++) |
| 12142 | { | ||
| 12143 | 84992 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, guyscripts[i], zmeta_version); | |
| 12144 | |||
| 12145 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if (ret) |
| 12146 | { | ||
| 12147 | ✗ | return qe_invalid; | |
| 12148 | } | ||
| 12149 | 84992 | } | |
| 12150 | |||
| 12151 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | script_data *fake = new script_data(ScriptType::None, 0); |
| 12152 |
2/2✓ Branch 0 taken 84992 times.
✓ Branch 1 taken 332 times.
|
85324 | for(int32_t i = 0; i < NUMSCRIPTWEAPONS; i++) |
| 12153 | { | ||
| 12154 | 84992 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, fake, zmeta_version); | |
| 12155 | |||
| 12156 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if (ret) |
| 12157 | { | ||
| 12158 | ✗ | return qe_invalid; | |
| 12159 | } | ||
| 12160 | 84992 | } | |
| 12161 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | delete fake; |
| 12162 | |||
| 12163 |
2/2✓ Branch 0 taken 84992 times.
✓ Branch 1 taken 332 times.
|
85324 | for(int32_t i = 0; i < NUMSCRIPTSCREEN; i++) |
| 12164 | { | ||
| 12165 | 84992 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, screenscripts[i], zmeta_version); | |
| 12166 | |||
| 12167 |
1/2✓ Branch 0 taken 84992 times.
✗ Branch 1 not taken.
|
84992 | if (ret) |
| 12168 | { | ||
| 12169 | ✗ | return qe_invalid; | |
| 12170 | } | ||
| 12171 | 84992 | } | |
| 12172 | |||
| 12173 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 189 times.
|
332 | if(s_version > 16) |
| 12174 | { | ||
| 12175 |
2/2✓ Branch 0 taken 1144 times.
✓ Branch 1 taken 143 times.
|
1287 | for(int32_t i = 0; i < NUMSCRIPTGLOBAL; ++i) |
| 12176 | { | ||
| 12177 | 1144 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, globalscripts[i], zmeta_version); | |
| 12178 | |||
| 12179 |
1/2✓ Branch 0 taken 1144 times.
✗ Branch 1 not taken.
|
1144 | if (ret) |
| 12180 | { | ||
| 12181 | ✗ | return qe_invalid; | |
| 12182 | } | ||
| 12183 | 1144 | } | |
| 12184 | 143 | } | |
| 12185 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 189 times.
|
189 | else if(s_version > 13) |
| 12186 | { | ||
| 12187 | ✗ | for(int32_t i = 0; i < NUMSCRIPTGLOBAL255OLD; ++i) | |
| 12188 | { | ||
| 12189 | ✗ | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, globalscripts[i], zmeta_version); | |
| 12190 | |||
| 12191 | ✗ | if (ret) | |
| 12192 | { | ||
| 12193 | ✗ | return qe_invalid; | |
| 12194 | } | ||
| 12195 | ✗ | } | |
| 12196 | |||
| 12197 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONSAVE] != NULL) | |
| 12198 | ✗ | delete globalscripts[GLOBAL_SCRIPT_ONSAVE]; | |
| 12199 | |||
| 12200 | ✗ | globalscripts[GLOBAL_SCRIPT_ONSAVE] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONSAVE); | |
| 12201 | ✗ | } | |
| 12202 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | else if(s_version > 4) |
| 12203 | { | ||
| 12204 |
2/2✓ Branch 0 taken 756 times.
✓ Branch 1 taken 189 times.
|
945 | for(int32_t i = 0; i < NUMSCRIPTGLOBAL253; ++i) |
| 12205 | { | ||
| 12206 | 756 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, globalscripts[i], zmeta_version); | |
| 12207 | |||
| 12208 |
1/2✓ Branch 0 taken 756 times.
✗ Branch 1 not taken.
|
756 | if (ret) |
| 12209 | { | ||
| 12210 | ✗ | return qe_invalid; | |
| 12211 | } | ||
| 12212 | 756 | } | |
| 12213 | |||
| 12214 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 189 times.
|
189 | if(globalscripts[GLOBAL_SCRIPT_ONLAUNCH] != NULL) |
| 12215 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | delete globalscripts[GLOBAL_SCRIPT_ONLAUNCH]; |
| 12216 | |||
| 12217 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | globalscripts[GLOBAL_SCRIPT_ONLAUNCH] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONLAUNCH); |
| 12218 | |||
| 12219 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 189 times.
|
189 | if(globalscripts[GLOBAL_SCRIPT_ONCONTGAME] != NULL) |
| 12220 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | delete globalscripts[GLOBAL_SCRIPT_ONCONTGAME]; |
| 12221 | |||
| 12222 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | globalscripts[GLOBAL_SCRIPT_ONCONTGAME] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONCONTGAME); |
| 12223 | |||
| 12224 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 189 times.
|
189 | if(globalscripts[GLOBAL_SCRIPT_F6] != NULL) |
| 12225 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | delete globalscripts[GLOBAL_SCRIPT_F6]; |
| 12226 | |||
| 12227 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | globalscripts[GLOBAL_SCRIPT_F6] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_F6); |
| 12228 | |||
| 12229 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 189 times.
|
189 | if(globalscripts[GLOBAL_SCRIPT_ONSAVE] != NULL) |
| 12230 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | delete globalscripts[GLOBAL_SCRIPT_ONSAVE]; |
| 12231 | |||
| 12232 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | globalscripts[GLOBAL_SCRIPT_ONSAVE] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONSAVE); |
| 12233 | 189 | } | |
| 12234 | else | ||
| 12235 | { | ||
| 12236 | ✗ | for(int32_t i = 0; i < NUMSCRIPTGLOBALOLD; i++) | |
| 12237 | { | ||
| 12238 | ✗ | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, globalscripts[i], zmeta_version); | |
| 12239 | |||
| 12240 | ✗ | if (ret) | |
| 12241 | { | ||
| 12242 | ✗ | return qe_invalid; | |
| 12243 | } | ||
| 12244 | ✗ | } | |
| 12245 | |||
| 12246 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONSAVELOAD] != NULL) | |
| 12247 | ✗ | delete globalscripts[GLOBAL_SCRIPT_ONSAVELOAD]; | |
| 12248 | |||
| 12249 | ✗ | globalscripts[GLOBAL_SCRIPT_ONSAVELOAD] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONSAVELOAD); | |
| 12250 | |||
| 12251 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONLAUNCH] != NULL) | |
| 12252 | ✗ | delete globalscripts[GLOBAL_SCRIPT_ONLAUNCH]; | |
| 12253 | |||
| 12254 | ✗ | globalscripts[GLOBAL_SCRIPT_ONLAUNCH] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONLAUNCH); | |
| 12255 | |||
| 12256 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONCONTGAME] != NULL) | |
| 12257 | ✗ | delete globalscripts[GLOBAL_SCRIPT_ONCONTGAME]; | |
| 12258 | |||
| 12259 | ✗ | globalscripts[GLOBAL_SCRIPT_ONCONTGAME] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONCONTGAME); | |
| 12260 | |||
| 12261 | ✗ | if(globalscripts[GLOBAL_SCRIPT_F6] != NULL) | |
| 12262 | ✗ | delete globalscripts[GLOBAL_SCRIPT_F6]; | |
| 12263 | |||
| 12264 | ✗ | globalscripts[GLOBAL_SCRIPT_F6] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_F6); | |
| 12265 | |||
| 12266 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONSAVE] != NULL) | |
| 12267 | ✗ | delete globalscripts[GLOBAL_SCRIPT_ONSAVE]; | |
| 12268 | |||
| 12269 | ✗ | globalscripts[GLOBAL_SCRIPT_ONSAVE] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONSAVE); | |
| 12270 | } | ||
| 12271 | |||
| 12272 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 189 times.
|
332 | if(s_version > 10) //expanded the number of Player scripts to 5. |
| 12273 | { | ||
| 12274 |
2/2✓ Branch 0 taken 715 times.
✓ Branch 1 taken 143 times.
|
858 | for(int32_t i = 0; i < NUMSCRIPTPLAYER; i++) |
| 12275 | { | ||
| 12276 | 715 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, playerscripts[i], zmeta_version); | |
| 12277 | |||
| 12278 |
1/2✓ Branch 0 taken 715 times.
✗ Branch 1 not taken.
|
715 | if (ret) |
| 12279 | { | ||
| 12280 | ✗ | return qe_invalid; | |
| 12281 | } | ||
| 12282 | 715 | } | |
| 12283 | 143 | } | |
| 12284 | else | ||
| 12285 | { | ||
| 12286 |
2/2✓ Branch 0 taken 567 times.
✓ Branch 1 taken 189 times.
|
756 | for(int32_t i = 0; i < NUMSCRIPTHEROOLD; i++) |
| 12287 | { | ||
| 12288 | 567 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, playerscripts[i], zmeta_version); | |
| 12289 | |||
| 12290 |
1/2✓ Branch 0 taken 567 times.
✗ Branch 1 not taken.
|
567 | if (ret) |
| 12291 | { | ||
| 12292 | ✗ | return qe_invalid; | |
| 12293 | } | ||
| 12294 | 567 | } | |
| 12295 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(playerscripts[3] != NULL) |
| 12296 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | delete playerscripts[3]; |
| 12297 | |||
| 12298 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | playerscripts[3] = new script_data(ScriptType::Player, 3); |
| 12299 | |||
| 12300 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(playerscripts[4] != NULL) |
| 12301 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 189 times.
|
189 | delete playerscripts[4]; |
| 12302 | |||
| 12303 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | playerscripts[4] = new script_data(ScriptType::Player, 4); |
| 12304 | } | ||
| 12305 |
3/4✓ Branch 0 taken 143 times.
✓ Branch 1 taken 189 times.
✓ Branch 2 taken 143 times.
✗ Branch 3 not taken.
|
332 | if(s_version > 8 && s_version < 10) |
| 12306 | { | ||
| 12307 | |||
| 12308 | ✗ | for(int32_t i = 0; i < NUMSCRIPTWEAPONS; i++) | |
| 12309 | { | ||
| 12310 | ✗ | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, ewpnscripts[i], zmeta_version); | |
| 12311 | |||
| 12312 | ✗ | if (ret) | |
| 12313 | { | ||
| 12314 | ✗ | return qe_invalid; | |
| 12315 | } | ||
| 12316 | ✗ | } | |
| 12317 | ✗ | for(int32_t i = 0; i < NUMSCRIPTSDMAP; i++) | |
| 12318 | { | ||
| 12319 | ✗ | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, dmapscripts[i], zmeta_version); | |
| 12320 | |||
| 12321 | ✗ | if (ret) | |
| 12322 | { | ||
| 12323 | ✗ | return qe_invalid; | |
| 12324 | } | ||
| 12325 | ✗ | } | |
| 12326 | |||
| 12327 | ✗ | } | |
| 12328 |
2/2✓ Branch 0 taken 189 times.
✓ Branch 1 taken 143 times.
|
332 | if(s_version >= 10) |
| 12329 | { | ||
| 12330 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 143 times.
|
36751 | for(int32_t i = 0; i < NUMSCRIPTWEAPONS; i++) |
| 12331 | { | ||
| 12332 | 36608 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, lwpnscripts[i], zmeta_version); | |
| 12333 | |||
| 12334 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if (ret) |
| 12335 | { | ||
| 12336 | ✗ | return qe_invalid; | |
| 12337 | } | ||
| 12338 | 36608 | } | |
| 12339 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 143 times.
|
36751 | for(int32_t i = 0; i < NUMSCRIPTWEAPONS; i++) |
| 12340 | { | ||
| 12341 | 36608 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, ewpnscripts[i], zmeta_version); | |
| 12342 | |||
| 12343 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if (ret) |
| 12344 | { | ||
| 12345 | ✗ | return qe_invalid; | |
| 12346 | } | ||
| 12347 | 36608 | } | |
| 12348 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 143 times.
|
36751 | for(int32_t i = 0; i < NUMSCRIPTSDMAP; i++) |
| 12349 | { | ||
| 12350 | 36608 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, dmapscripts[i], zmeta_version); | |
| 12351 | |||
| 12352 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if (ret) |
| 12353 | { | ||
| 12354 | ✗ | return qe_invalid; | |
| 12355 | } | ||
| 12356 | 36608 | } | |
| 12357 | |||
| 12358 | 143 | } | |
| 12359 |
2/2✓ Branch 0 taken 189 times.
✓ Branch 1 taken 143 times.
|
332 | if(s_version >=12) |
| 12360 | { | ||
| 12361 |
2/2✓ Branch 0 taken 36608 times.
✓ Branch 1 taken 143 times.
|
36751 | for(int32_t i = 0; i < NUMSCRIPTSITEMSPRITE; i++) |
| 12362 | { | ||
| 12363 | 36608 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, itemspritescripts[i], zmeta_version); | |
| 12364 | |||
| 12365 |
1/2✓ Branch 0 taken 36608 times.
✗ Branch 1 not taken.
|
36608 | if (ret) |
| 12366 | { | ||
| 12367 | ✗ | return qe_invalid; | |
| 12368 | } | ||
| 12369 | 36608 | } | |
| 12370 | 143 | } | |
| 12371 |
2/2✓ Branch 0 taken 189 times.
✓ Branch 1 taken 143 times.
|
332 | if(s_version >=15) |
| 12372 | { | ||
| 12373 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 143 times.
|
73359 | for(int32_t i = 0; i < NUMSCRIPTSCOMBODATA; i++) |
| 12374 | { | ||
| 12375 | 73216 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, comboscripts[i], zmeta_version); | |
| 12376 | |||
| 12377 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if (ret) |
| 12378 | { | ||
| 12379 | ✗ | return qe_invalid; | |
| 12380 | } | ||
| 12381 | 73216 | } | |
| 12382 | 143 | } | |
| 12383 |
2/2✓ Branch 0 taken 189 times.
✓ Branch 1 taken 143 times.
|
332 | if(s_version >19) |
| 12384 | { | ||
| 12385 | 143 | word numgenscripts = NUMSCRIPTSGENERIC; | |
| 12386 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_igetw(&numgenscripts,f)) |
| 12387 | { | ||
| 12388 | ✗ | return qe_invalid; | |
| 12389 | } | ||
| 12390 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 143 times.
|
73359 | for(int32_t i = 0; i < numgenscripts; i++) |
| 12391 | { | ||
| 12392 | 73216 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, genericscripts[i], zmeta_version); | |
| 12393 | |||
| 12394 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if (ret) |
| 12395 | { | ||
| 12396 | ✗ | return qe_invalid; | |
| 12397 | } | ||
| 12398 | 73216 | } | |
| 12399 | 143 | } | |
| 12400 |
2/2✓ Branch 0 taken 206 times.
✓ Branch 1 taken 126 times.
|
332 | if(s_version >21) |
| 12401 | { | ||
| 12402 | 126 | word numsubscripts = NUMSCRIPTSSUBSCREEN; | |
| 12403 |
1/2✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
|
126 | if(!p_igetw(&numsubscripts,f)) |
| 12404 | { | ||
| 12405 | ✗ | return qe_invalid; | |
| 12406 | } | ||
| 12407 |
2/2✓ Branch 0 taken 32256 times.
✓ Branch 1 taken 126 times.
|
32382 | for(int32_t i = 0; i < numsubscripts; i++) |
| 12408 | { | ||
| 12409 | 32256 | ret = read_one_ffscript(f, Header, i, s_version, s_cversion, subscreenscripts[i], zmeta_version); | |
| 12410 | |||
| 12411 |
1/2✓ Branch 0 taken 32256 times.
✗ Branch 1 not taken.
|
32256 | if (ret) |
| 12412 | { | ||
| 12413 | ✗ | return qe_invalid; | |
| 12414 | } | ||
| 12415 | 32256 | } | |
| 12416 | 126 | } | |
| 12417 | 332 | } | |
| 12418 | |||
| 12419 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | if(s_version > 2) |
| 12420 | { | ||
| 12421 | int32_t bufsize; | ||
| 12422 | 332 | p_igetl(&bufsize, f); | |
| 12423 |
2/4✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 332 times.
|
332 | if (bufsize < 0 || bufsize > 1024*1024*10) |
| 12424 | { | ||
| 12425 | // God help anyone storing more than 10MB of code in the script buffer. | ||
| 12426 | ✗ | return qe_invalid; | |
| 12427 | } | ||
| 12428 | 332 | char * buf = new char[bufsize+1]; | |
| 12429 | 332 | pfread(buf, bufsize, f); | |
| 12430 | 332 | buf[bufsize]=0; | |
| 12431 | |||
| 12432 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | zScript = string(buf); |
| 12433 | |||
| 12434 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | delete[] buf; |
| 12435 | word numffcbindings; | ||
| 12436 | 332 | p_igetw(&numffcbindings, f); | |
| 12437 | |||
| 12438 |
2/2✓ Branch 0 taken 9549 times.
✓ Branch 1 taken 332 times.
|
9881 | for(int32_t i=0; i<numffcbindings; i++) |
| 12439 | { | ||
| 12440 | word id; | ||
| 12441 | 9549 | p_igetw(&id, f); | |
| 12442 | 9549 | p_igetl(&bufsize, f); | |
| 12443 |
2/4✓ Branch 0 taken 9549 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 9549 times.
|
9549 | if (bufsize < 0 || bufsize > 1024) |
| 12444 | ✗ | return qe_invalid; | |
| 12445 | 9549 | buf = new char[bufsize+1]; | |
| 12446 | 9549 | pfread(buf, bufsize, f); | |
| 12447 | 9549 | buf[bufsize]=0; | |
| 12448 | |||
| 12449 | //fix for buggy older saved quests -DD | ||
| 12450 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9549 times.
|
9549 | if(id < NUMSCRIPTFFC-1) |
| 12451 | 9549 | ffcmap[id].scriptname = buf; | |
| 12452 | |||
| 12453 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9549 times.
|
9549 | delete[] buf; |
| 12454 | 9549 | } | |
| 12455 | |||
| 12456 | word numglobalbindings; | ||
| 12457 | 332 | p_igetw(&numglobalbindings, f); | |
| 12458 | |||
| 12459 |
2/2✓ Branch 0 taken 1475 times.
✓ Branch 1 taken 332 times.
|
1807 | for(int32_t i=0; i<numglobalbindings; i++) |
| 12460 | { | ||
| 12461 | word id; | ||
| 12462 | 1475 | p_igetw(&id, f); | |
| 12463 | 1475 | p_igetl(&bufsize, f); | |
| 12464 |
2/4✓ Branch 0 taken 1475 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1475 times.
✗ Branch 3 not taken.
|
1475 | if (bufsize < 0 || bufsize > 1024) |
| 12465 | ✗ | return qe_invalid; | |
| 12466 | 1475 | buf = new char[bufsize+1]; | |
| 12467 | 1475 | pfread(buf, bufsize, f); | |
| 12468 | 1475 | buf[bufsize]=0; | |
| 12469 | |||
| 12470 | // id in principle should be valid, since slot assignment cannot assign a global script to a bogus slot. | ||
| 12471 | // However, because of a corruption bug, some 2.50.x quests contain bogus entries in the global bindings table. | ||
| 12472 | // Ignore these. -DD | ||
| 12473 |
2/2✓ Branch 0 taken 540 times.
✓ Branch 1 taken 935 times.
|
1475 | if (id < NUMSCRIPTGLOBAL) |
| 12474 | { | ||
| 12475 | //Disable old '~Continue's, they'd wreak havoc. Bit messy, apologies ~Joe | ||
| 12476 |
1/2✓ Branch 0 taken 935 times.
✗ Branch 1 not taken.
|
935 | if(strcmp(buf,"~Continue") == 0) |
| 12477 | { | ||
| 12478 | ✗ | globalmap[id].scriptname = ""; | |
| 12479 | |||
| 12480 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONSAVELOAD] != NULL) | |
| 12481 | ✗ | globalscripts[GLOBAL_SCRIPT_ONSAVELOAD]->disable(); | |
| 12482 | ✗ | } | |
| 12483 | else | ||
| 12484 | { | ||
| 12485 | 935 | globalmap[id].scriptname = buf; | |
| 12486 | } | ||
| 12487 | 935 | } | |
| 12488 | |||
| 12489 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1475 times.
|
1475 | delete[] buf; |
| 12490 | 1475 | } | |
| 12491 | |||
| 12492 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | if(s_version > 3) |
| 12493 | { | ||
| 12494 | word numitembindings; | ||
| 12495 | 332 | p_igetw(&numitembindings, f); | |
| 12496 | |||
| 12497 |
2/2✓ Branch 0 taken 1267 times.
✓ Branch 1 taken 332 times.
|
1599 | for(int32_t i=0; i<numitembindings; i++) |
| 12498 | { | ||
| 12499 | word id; | ||
| 12500 | 1267 | p_igetw(&id, f); | |
| 12501 | 1267 | p_igetl(&bufsize, f); | |
| 12502 |
2/4✓ Branch 0 taken 1267 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1267 times.
|
1267 | if (bufsize < 0 || bufsize > 1024) |
| 12503 | ✗ | return qe_invalid; | |
| 12504 | 1267 | buf = new char[bufsize+1]; | |
| 12505 | 1267 | pfread(buf, bufsize, f); | |
| 12506 | 1267 | buf[bufsize]=0; | |
| 12507 | |||
| 12508 | //fix this too | ||
| 12509 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1267 times.
|
1267 | if(id <NUMSCRIPTITEM-1) |
| 12510 | 1267 | itemmap[id].scriptname = buf; | |
| 12511 | |||
| 12512 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1267 times.
|
1267 | delete[] buf; |
| 12513 | 1267 | } | |
| 12514 | 332 | } | |
| 12515 | //(v9+) | ||
| 12516 |
2/2✓ Branch 0 taken 189 times.
✓ Branch 1 taken 143 times.
|
332 | if(s_version > 8) |
| 12517 | { | ||
| 12518 | //npc scripts | ||
| 12519 | word numnpcbindings; | ||
| 12520 | 143 | p_igetw(&numnpcbindings, f); | |
| 12521 | |||
| 12522 |
2/2✓ Branch 0 taken 31 times.
✓ Branch 1 taken 143 times.
|
174 | for(int32_t i=0; i<numnpcbindings; i++) |
| 12523 | { | ||
| 12524 | word id; | ||
| 12525 | 31 | p_igetw(&id, f); | |
| 12526 | 31 | p_igetl(&bufsize, f); | |
| 12527 |
2/4✓ Branch 0 taken 31 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 31 times.
✗ Branch 3 not taken.
|
31 | if (bufsize < 0 || bufsize > 1024) |
| 12528 | ✗ | return qe_invalid; | |
| 12529 | 31 | buf = new char[bufsize+1]; | |
| 12530 | 31 | pfread(buf, bufsize, f); | |
| 12531 | 31 | buf[bufsize]=0; | |
| 12532 | |||
| 12533 | //fix this too | ||
| 12534 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 31 times.
|
31 | if(id <NUMSCRIPTGUYS-1) |
| 12535 | 31 | npcmap[id].scriptname = buf; | |
| 12536 | |||
| 12537 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 31 times.
|
31 | delete[] buf; |
| 12538 | 31 | } | |
| 12539 | //lweapon | ||
| 12540 | word numlwpnbindings; | ||
| 12541 | 143 | p_igetw(&numlwpnbindings, f); | |
| 12542 | |||
| 12543 |
2/2✓ Branch 0 taken 213 times.
✓ Branch 1 taken 143 times.
|
356 | for(int32_t i=0; i<numlwpnbindings; i++) |
| 12544 | { | ||
| 12545 | word id; | ||
| 12546 | 213 | p_igetw(&id, f); | |
| 12547 | 213 | p_igetl(&bufsize, f); | |
| 12548 |
2/4✓ Branch 0 taken 213 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 213 times.
✗ Branch 3 not taken.
|
213 | if (bufsize < 0 || bufsize > 1024) |
| 12549 | ✗ | return qe_invalid; | |
| 12550 | 213 | buf = new char[bufsize+1]; | |
| 12551 | 213 | pfread(buf, bufsize, f); | |
| 12552 | 213 | buf[bufsize]=0; | |
| 12553 | |||
| 12554 | //fix this too | ||
| 12555 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 213 times.
|
213 | if(id <NUMSCRIPTWEAPONS-1) |
| 12556 | 213 | lwpnmap[id].scriptname = buf; | |
| 12557 | |||
| 12558 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 213 times.
|
213 | delete[] buf; |
| 12559 | 213 | } | |
| 12560 | //eweapon | ||
| 12561 | word numewpnbindings; | ||
| 12562 | 143 | p_igetw(&numewpnbindings, f); | |
| 12563 | |||
| 12564 |
2/2✓ Branch 0 taken 280 times.
✓ Branch 1 taken 143 times.
|
423 | for(int32_t i=0; i<numewpnbindings; i++) |
| 12565 | { | ||
| 12566 | word id; | ||
| 12567 | 280 | p_igetw(&id, f); | |
| 12568 | 280 | p_igetl(&bufsize, f); | |
| 12569 |
2/4✓ Branch 0 taken 280 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 280 times.
✗ Branch 3 not taken.
|
280 | if (bufsize < 0 || bufsize > 1024) |
| 12570 | ✗ | return qe_invalid; | |
| 12571 | 280 | buf = new char[bufsize+1]; | |
| 12572 | 280 | pfread(buf, bufsize, f); | |
| 12573 | 280 | buf[bufsize]=0; | |
| 12574 | |||
| 12575 | //fix this too | ||
| 12576 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 280 times.
|
280 | if(id <NUMSCRIPTWEAPONS-1) |
| 12577 | 280 | ewpnmap[id].scriptname = buf; | |
| 12578 | |||
| 12579 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 280 times.
|
280 | delete[] buf; |
| 12580 | 280 | } | |
| 12581 | //hero | ||
| 12582 | word numherobindings; | ||
| 12583 | 143 | p_igetw(&numherobindings, f); | |
| 12584 | |||
| 12585 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 143 times.
|
164 | for(int32_t i=0; i<numherobindings; i++) |
| 12586 | { | ||
| 12587 | word id; | ||
| 12588 | 21 | p_igetw(&id, f); | |
| 12589 | 21 | p_igetl(&bufsize, f); | |
| 12590 |
2/4✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 21 times.
|
21 | if (bufsize < 0 || bufsize > 1024) |
| 12591 | ✗ | return qe_invalid; | |
| 12592 | 21 | buf = new char[bufsize+1]; | |
| 12593 | 21 | pfread(buf, bufsize, f); | |
| 12594 | 21 | buf[bufsize]=0; | |
| 12595 | |||
| 12596 | //fix this too | ||
| 12597 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
|
21 | if(id <NUMSCRIPTPLAYER-1) |
| 12598 | 21 | playermap[id].scriptname = buf; | |
| 12599 | |||
| 12600 |
1/2✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
|
21 | delete[] buf; |
| 12601 | 21 | } | |
| 12602 | //dmaps | ||
| 12603 | word numdmapbindings; | ||
| 12604 | 143 | p_igetw(&numdmapbindings, f); | |
| 12605 | |||
| 12606 |
2/2✓ Branch 0 taken 247 times.
✓ Branch 1 taken 143 times.
|
390 | for(int32_t i=0; i<numdmapbindings; i++) |
| 12607 | { | ||
| 12608 | word id; | ||
| 12609 | 247 | p_igetw(&id, f); | |
| 12610 | 247 | p_igetl(&bufsize, f); | |
| 12611 |
2/4✓ Branch 0 taken 247 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 247 times.
✗ Branch 3 not taken.
|
247 | if (bufsize < 0 || bufsize > 1024) |
| 12612 | ✗ | return qe_invalid; | |
| 12613 | 247 | buf = new char[bufsize+1]; | |
| 12614 | 247 | pfread(buf, bufsize, f); | |
| 12615 | 247 | buf[bufsize]=0; | |
| 12616 | |||
| 12617 | //fix this too | ||
| 12618 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 247 times.
|
247 | if(id <NUMSCRIPTSDMAP-1) |
| 12619 | 247 | dmapmap[id].scriptname = buf; | |
| 12620 | |||
| 12621 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 247 times.
|
247 | delete[] buf; |
| 12622 | 247 | } | |
| 12623 | //screen | ||
| 12624 | word numscreenbindings; | ||
| 12625 | 143 | p_igetw(&numscreenbindings, f); | |
| 12626 | |||
| 12627 |
2/2✓ Branch 0 taken 424 times.
✓ Branch 1 taken 143 times.
|
567 | for(int32_t i=0; i<numscreenbindings; i++) |
| 12628 | { | ||
| 12629 | word id; | ||
| 12630 | 424 | p_igetw(&id, f); | |
| 12631 | 424 | p_igetl(&bufsize, f); | |
| 12632 |
2/4✓ Branch 0 taken 424 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 424 times.
✗ Branch 3 not taken.
|
424 | if (bufsize < 0 || bufsize > 1024) |
| 12633 | ✗ | return qe_invalid; | |
| 12634 | 424 | buf = new char[bufsize+1]; | |
| 12635 | 424 | pfread(buf, bufsize, f); | |
| 12636 | 424 | buf[bufsize]=0; | |
| 12637 | |||
| 12638 | //fix this too | ||
| 12639 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 424 times.
|
424 | if(id <NUMSCRIPTSDMAP-1) |
| 12640 | 424 | screenmap[id].scriptname = buf; | |
| 12641 | |||
| 12642 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 424 times.
|
424 | delete[] buf; |
| 12643 | 424 | } | |
| 12644 | 143 | } | |
| 12645 |
2/2✓ Branch 0 taken 189 times.
✓ Branch 1 taken 143 times.
|
332 | if(s_version > 11) |
| 12646 | { | ||
| 12647 | word numspritebindings; | ||
| 12648 | 143 | p_igetw(&numspritebindings, f); | |
| 12649 | |||
| 12650 |
2/2✓ Branch 0 taken 44 times.
✓ Branch 1 taken 143 times.
|
187 | for(int32_t i=0; i<numspritebindings; i++) |
| 12651 | { | ||
| 12652 | word id; | ||
| 12653 | 44 | p_igetw(&id, f); | |
| 12654 | 44 | p_igetl(&bufsize, f); | |
| 12655 |
2/4✓ Branch 0 taken 44 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 44 times.
✗ Branch 3 not taken.
|
44 | if (bufsize < 0 || bufsize > 1024) |
| 12656 | ✗ | return qe_invalid; | |
| 12657 | 44 | buf = new char[bufsize+1]; | |
| 12658 | 44 | pfread(buf, bufsize, f); | |
| 12659 | 44 | buf[bufsize]=0; | |
| 12660 | |||
| 12661 | //fix this too | ||
| 12662 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44 times.
|
44 | if(id <NUMSCRIPTSDMAP-1) |
| 12663 | 44 | itemspritemap[id].scriptname = buf; | |
| 12664 | |||
| 12665 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44 times.
|
44 | delete[] buf; |
| 12666 | 44 | } | |
| 12667 | 143 | } | |
| 12668 |
2/2✓ Branch 0 taken 189 times.
✓ Branch 1 taken 143 times.
|
332 | if(s_version >= 15) |
| 12669 | { | ||
| 12670 | word numcombobindings; | ||
| 12671 | 143 | p_igetw(&numcombobindings, f); | |
| 12672 | |||
| 12673 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 143 times.
|
286 | for(int32_t i=0; i<numcombobindings; i++) |
| 12674 | { | ||
| 12675 | word id; | ||
| 12676 | 143 | p_igetw(&id, f); | |
| 12677 | 143 | p_igetl(&bufsize, f); | |
| 12678 |
2/4✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 143 times.
|
143 | if (bufsize < 0 || bufsize > 1024) |
| 12679 | ✗ | return qe_invalid; | |
| 12680 | 143 | buf = new char[bufsize+1]; | |
| 12681 | 143 | pfread(buf, bufsize, f); | |
| 12682 | 143 | buf[bufsize]=0; | |
| 12683 | |||
| 12684 | //fix this too | ||
| 12685 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 143 times.
|
143 | if(id <NUMSCRIPTSCOMBODATA-1) |
| 12686 | 143 | comboscriptmap[id].scriptname = buf; | |
| 12687 | |||
| 12688 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 143 times.
|
143 | delete[] buf; |
| 12689 | 143 | } | |
| 12690 | 143 | } | |
| 12691 |
2/2✓ Branch 0 taken 189 times.
✓ Branch 1 taken 143 times.
|
332 | if(s_version > 19) |
| 12692 | { | ||
| 12693 | word numgenericbindings; | ||
| 12694 | 143 | p_igetw(&numgenericbindings, f); | |
| 12695 | |||
| 12696 |
2/2✓ Branch 0 taken 483 times.
✓ Branch 1 taken 143 times.
|
626 | for(int32_t i=0; i<numgenericbindings; i++) |
| 12697 | { | ||
| 12698 | word id; | ||
| 12699 | 483 | p_igetw(&id, f); | |
| 12700 | 483 | p_igetl(&bufsize, f); | |
| 12701 |
2/4✓ Branch 0 taken 483 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 483 times.
|
483 | if (bufsize < 0 || bufsize > 1024) |
| 12702 | ✗ | return qe_invalid; | |
| 12703 | 483 | buf = new char[bufsize+1]; | |
| 12704 | 483 | pfread(buf, bufsize, f); | |
| 12705 | 483 | buf[bufsize]=0; | |
| 12706 | |||
| 12707 | //fix this too | ||
| 12708 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 483 times.
|
483 | if(id <NUMSCRIPTSGENERIC-1) |
| 12709 | 483 | genericmap[id].scriptname = buf; | |
| 12710 | |||
| 12711 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 483 times.
|
483 | delete[] buf; |
| 12712 | 483 | } | |
| 12713 | 143 | } | |
| 12714 |
2/2✓ Branch 0 taken 206 times.
✓ Branch 1 taken 126 times.
|
332 | if(s_version > 21) |
| 12715 | { | ||
| 12716 | word numsubscreenbindings; | ||
| 12717 | 126 | p_igetw(&numsubscreenbindings, f); | |
| 12718 | |||
| 12719 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 126 times.
|
133 | for(int32_t i=0; i<numsubscreenbindings; i++) |
| 12720 | { | ||
| 12721 | word id; | ||
| 12722 | 7 | p_igetw(&id, f); | |
| 12723 | 7 | p_igetl(&bufsize, f); | |
| 12724 |
2/4✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 7 times.
|
7 | if (bufsize < 0 || bufsize > 1024) |
| 12725 | ✗ | return qe_invalid; | |
| 12726 | 7 | buf = new char[bufsize+1]; | |
| 12727 | 7 | pfread(buf, bufsize, f); | |
| 12728 | 7 | buf[bufsize]=0; | |
| 12729 | |||
| 12730 | //fix this too | ||
| 12731 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
|
7 | if(id <NUMSCRIPTSSUBSCREEN-1) |
| 12732 | 7 | subscreenmap[id].scriptname = buf; | |
| 12733 | |||
| 12734 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
|
7 | delete[] buf; |
| 12735 | 7 | } | |
| 12736 | 126 | } | |
| 12737 | 332 | } | |
| 12738 | |||
| 12739 | // Set ZScriptVersion to the value encoded in the script's meta.ffscript_v. | ||
| 12740 | // This is only updated when the scripts have been recompiled. | ||
| 12741 | // They should all match each other. | ||
| 12742 | 332 | std::optional<word> zscript_version; | |
| 12743 |
2/2✓ Branch 0 taken 189 times.
✓ Branch 1 taken 143 times.
|
332 | if (s_version >= 16) |
| 12744 | { | ||
| 12745 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | for (auto script : read_scripts) |
| 12746 | { | ||
| 12747 | ✗ | if (script->meta.ffscript_v == 0 || script->meta.ffscript_v > s_version) | |
| 12748 | ✗ | break; | |
| 12749 | |||
| 12750 | ✗ | if (!zscript_version.has_value()) | |
| 12751 | { | ||
| 12752 | ✗ | zscript_version = script->meta.ffscript_v; | |
| 12753 | ✗ | continue; | |
| 12754 | } | ||
| 12755 | |||
| 12756 | ✗ | if (zscript_version.value() != script->meta.ffscript_v) | |
| 12757 | { | ||
| 12758 | ✗ | zscript_version.reset(); | |
| 12759 | ✗ | break; | |
| 12760 | } | ||
| 12761 | } | ||
| 12762 | |||
| 12763 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 143 times.
|
143 | if (!zscript_version.has_value()) |
| 12764 | 143 | al_trace("WARNING: Setting zscript version to section version as fallback.\n"); | |
| 12765 | 143 | } | |
| 12766 | 332 | setZScriptVersion(zscript_version.value_or(s_version)); | |
| 12767 | 332 | read_scripts.clear(); | |
| 12768 | |||
| 12769 | 332 | return 0; | |
| 12770 | 332 | } | |
| 12771 | |||
| 12772 | void(*reset_scripts_hook)(); | ||
| 12773 | |||
| 12774 | 414 | void reset_scripts() | |
| 12775 | { | ||
| 12776 | // We can't modify the script data while jit threads are possibly compiling them. | ||
| 12777 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 405 times.
|
414 | if (reset_scripts_hook) |
| 12778 | 405 | reset_scripts_hook(); | |
| 12779 | |||
| 12780 |
2/2✓ Branch 0 taken 211968 times.
✓ Branch 1 taken 414 times.
|
212382 | for(int32_t i=0; i<NUMSCRIPTSGENERIC; i++) |
| 12781 | { | ||
| 12782 |
1/2✓ Branch 0 taken 211968 times.
✗ Branch 1 not taken.
|
211968 | if (genericscripts[i]!=NULL) genericscripts[i]->disable(); |
| 12783 | ✗ | else genericscripts[i] = new script_data({ScriptType::Generic, i}); | |
| 12784 | 211968 | } | |
| 12785 | |||
| 12786 |
2/2✓ Branch 0 taken 211968 times.
✓ Branch 1 taken 414 times.
|
212382 | for(int32_t i=0; i<NUMSCRIPTFFC; i++) |
| 12787 | { | ||
| 12788 |
1/2✓ Branch 0 taken 211968 times.
✗ Branch 1 not taken.
|
211968 | if (ffscripts[i]) |
| 12789 | 211968 | ffscripts[i]->disable(); | |
| 12790 | else | ||
| 12791 | ✗ | ffscripts[i] = new script_data(ScriptType::FFC, i); | |
| 12792 | 211968 | } | |
| 12793 | |||
| 12794 |
2/2✓ Branch 0 taken 105984 times.
✓ Branch 1 taken 414 times.
|
106398 | for(int32_t i=0; i<NUMSCRIPTITEM; i++) |
| 12795 | { | ||
| 12796 |
1/2✓ Branch 0 taken 105984 times.
✗ Branch 1 not taken.
|
105984 | if (itemscripts[i]) |
| 12797 | 105984 | itemscripts[i]->disable(); | |
| 12798 | else | ||
| 12799 | ✗ | itemscripts[i] = new script_data(ScriptType::Item, i); | |
| 12800 | 105984 | } | |
| 12801 | |||
| 12802 |
2/2✓ Branch 0 taken 105984 times.
✓ Branch 1 taken 414 times.
|
106398 | for(int32_t i=0; i<NUMSCRIPTGUYS; i++) |
| 12803 | { | ||
| 12804 |
1/2✓ Branch 0 taken 105984 times.
✗ Branch 1 not taken.
|
105984 | if (guyscripts[i]) |
| 12805 | 105984 | guyscripts[i]->disable(); | |
| 12806 | else | ||
| 12807 | ✗ | guyscripts[i] = new script_data(ScriptType::NPC, i); | |
| 12808 | 105984 | } | |
| 12809 | |||
| 12810 |
2/2✓ Branch 0 taken 105984 times.
✓ Branch 1 taken 414 times.
|
106398 | for(int32_t i=0; i<NUMSCRIPTSCREEN; i++) |
| 12811 | { | ||
| 12812 |
1/2✓ Branch 0 taken 105984 times.
✗ Branch 1 not taken.
|
105984 | if (screenscripts[i]) |
| 12813 | 105984 | screenscripts[i]->disable(); | |
| 12814 | else | ||
| 12815 | ✗ | screenscripts[i] = new script_data(ScriptType::Screen, i); | |
| 12816 | 105984 | } | |
| 12817 | |||
| 12818 |
2/2✓ Branch 0 taken 3312 times.
✓ Branch 1 taken 414 times.
|
3726 | for(int32_t i=0; i<NUMSCRIPTGLOBAL; i++) |
| 12819 | { | ||
| 12820 |
1/2✓ Branch 0 taken 3312 times.
✗ Branch 1 not taken.
|
3312 | if (globalscripts[i]) |
| 12821 | 3312 | globalscripts[i]->disable(); | |
| 12822 | else | ||
| 12823 | ✗ | globalscripts[i] = new script_data(ScriptType::Global, i); | |
| 12824 | 3312 | } | |
| 12825 | |||
| 12826 |
2/2✓ Branch 0 taken 2070 times.
✓ Branch 1 taken 414 times.
|
2484 | for(int32_t i=0; i<NUMSCRIPTPLAYER; i++) |
| 12827 | { | ||
| 12828 |
1/2✓ Branch 0 taken 2070 times.
✗ Branch 1 not taken.
|
2070 | if (playerscripts[i]) |
| 12829 | 2070 | playerscripts[i]->disable(); | |
| 12830 | else | ||
| 12831 | ✗ | playerscripts[i] = new script_data(ScriptType::Player, i); | |
| 12832 | 2070 | } | |
| 12833 | |||
| 12834 |
2/2✓ Branch 0 taken 105984 times.
✓ Branch 1 taken 414 times.
|
106398 | for(int32_t i=0; i<NUMSCRIPTWEAPONS; i++) |
| 12835 | { | ||
| 12836 |
1/2✓ Branch 0 taken 105984 times.
✗ Branch 1 not taken.
|
105984 | if (lwpnscripts[i]) |
| 12837 | 105984 | lwpnscripts[i]->disable(); | |
| 12838 | else | ||
| 12839 | ✗ | lwpnscripts[i] = new script_data(ScriptType::Lwpn, i); | |
| 12840 | 105984 | } | |
| 12841 |
2/2✓ Branch 0 taken 105984 times.
✓ Branch 1 taken 414 times.
|
106398 | for(int32_t i=0; i<NUMSCRIPTWEAPONS; i++) |
| 12842 | { | ||
| 12843 |
1/2✓ Branch 0 taken 105984 times.
✗ Branch 1 not taken.
|
105984 | if (ewpnscripts[i]) |
| 12844 | 105984 | ewpnscripts[i]->disable(); | |
| 12845 | else | ||
| 12846 | ✗ | ewpnscripts[i] = new script_data(ScriptType::Ewpn, i); | |
| 12847 | 105984 | } | |
| 12848 | |||
| 12849 |
2/2✓ Branch 0 taken 105984 times.
✓ Branch 1 taken 414 times.
|
106398 | for(int32_t i=0; i<NUMSCRIPTSDMAP; i++) |
| 12850 | { | ||
| 12851 |
1/2✓ Branch 0 taken 105984 times.
✗ Branch 1 not taken.
|
105984 | if (dmapscripts[i]) |
| 12852 | 105984 | dmapscripts[i]->disable(); | |
| 12853 | else | ||
| 12854 | ✗ | dmapscripts[i] = new script_data(ScriptType::DMap, i); | |
| 12855 | 105984 | } | |
| 12856 |
2/2✓ Branch 0 taken 105984 times.
✓ Branch 1 taken 414 times.
|
106398 | for(int32_t i=0; i<NUMSCRIPTSITEMSPRITE; i++) |
| 12857 | { | ||
| 12858 |
1/2✓ Branch 0 taken 105984 times.
✗ Branch 1 not taken.
|
105984 | if (itemspritescripts[i]) |
| 12859 | 105984 | itemspritescripts[i]->disable(); | |
| 12860 | else | ||
| 12861 | ✗ | itemspritescripts[i] = new script_data(ScriptType::ItemSprite, i); | |
| 12862 | 105984 | } | |
| 12863 |
2/2✓ Branch 0 taken 211968 times.
✓ Branch 1 taken 414 times.
|
212382 | for(int32_t i=0; i<NUMSCRIPTSCOMBODATA; i++) |
| 12864 | { | ||
| 12865 |
1/2✓ Branch 0 taken 211968 times.
✗ Branch 1 not taken.
|
211968 | if (comboscripts[i]) |
| 12866 | 211968 | comboscripts[i]->disable(); | |
| 12867 | else | ||
| 12868 | ✗ | comboscripts[i] = new script_data(ScriptType::Combo, i); | |
| 12869 | 211968 | } | |
| 12870 |
2/2✓ Branch 0 taken 414 times.
✓ Branch 1 taken 105984 times.
|
106398 | for(int32_t i=0; i<NUMSCRIPTSSUBSCREEN; i++) |
| 12871 | { | ||
| 12872 |
1/2✓ Branch 0 taken 105984 times.
✗ Branch 1 not taken.
|
105984 | if (subscreenscripts[i]) |
| 12873 | 105984 | subscreenscripts[i]->disable(); | |
| 12874 | else | ||
| 12875 | ✗ | subscreenscripts[i] = new script_data(ScriptType::EngineSubscreen, i); | |
| 12876 | 105984 | } | |
| 12877 | 414 | } | |
| 12878 | |||
| 12879 | 838254 | int32_t read_one_ffscript(PACKFILE *f, zquestheader *, int32_t script_index, word s_version, word , script_data *script, word zmeta_version) | |
| 12880 | { | ||
| 12881 | ASSERT(script); | ||
| 12882 | |||
| 12883 | //Please also update loadquest() when modifying this method -DD | ||
| 12884 | 838254 | char b33[34] = {0}; | |
| 12885 | 838254 | b33[33] = 0; | |
| 12886 | 838254 | int32_t num_commands=1000; | |
| 12887 | |||
| 12888 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 838254 times.
|
838254 | if(s_version>=2) |
| 12889 | { | ||
| 12890 |
1/2✓ Branch 0 taken 838254 times.
✗ Branch 1 not taken.
|
838254 | if(!p_igetl(&num_commands,f)) |
| 12891 | { | ||
| 12892 | ✗ | return qe_invalid; | |
| 12893 | } | ||
| 12894 | 838254 | } | |
| 12895 | |||
| 12896 | #ifdef ZC_FUZZ | ||
| 12897 | const int32_t command_limit = 300000; | ||
| 12898 | #else | ||
| 12899 | 838254 | const int32_t command_limit = 10000000; | |
| 12900 | #endif | ||
| 12901 |
2/4✓ Branch 0 taken 838254 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 838254 times.
|
838254 | if (num_commands < 0 || num_commands > command_limit) |
| 12902 | { | ||
| 12903 | ✗ | return qe_invalid; | |
| 12904 | } | ||
| 12905 | |||
| 12906 | 838254 | std::vector<ffscript> zasm; | |
| 12907 |
1/2✓ Branch 0 taken 838254 times.
✗ Branch 1 not taken.
|
838254 | zasm.reserve(num_commands); |
| 12908 | |||
| 12909 |
2/2✓ Branch 0 taken 546627 times.
✓ Branch 1 taken 291627 times.
|
838254 | if(s_version >= 16) |
| 12910 | { | ||
| 12911 |
1/2✓ Branch 0 taken 546627 times.
✗ Branch 1 not taken.
|
546627 | zasm_meta temp_meta; |
| 12912 | |||
| 12913 |
2/4✓ Branch 0 taken 546627 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 546627 times.
✗ Branch 3 not taken.
|
546627 | if(!p_igetw(&(temp_meta.zasm_v),f)) |
| 12914 | { | ||
| 12915 | ✗ | return qe_invalid; | |
| 12916 | } | ||
| 12917 | |||
| 12918 |
2/4✓ Branch 0 taken 546627 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 546627 times.
✗ Branch 3 not taken.
|
546627 | if(!p_igetw(&(temp_meta.meta_v),f)) |
| 12919 | { | ||
| 12920 | ✗ | return qe_invalid; | |
| 12921 | } | ||
| 12922 | |||
| 12923 |
2/4✓ Branch 0 taken 546627 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 546627 times.
✗ Branch 3 not taken.
|
546627 | if(!p_igetw(&(temp_meta.ffscript_v),f)) |
| 12924 | { | ||
| 12925 | ✗ | return qe_invalid; | |
| 12926 | } | ||
| 12927 | |||
| 12928 |
2/4✓ Branch 0 taken 546627 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 546627 times.
✗ Branch 3 not taken.
|
546627 | if(!p_getc(&(temp_meta.script_type),f)) |
| 12929 | { | ||
| 12930 | ✗ | return qe_invalid; | |
| 12931 | } | ||
| 12932 | |||
| 12933 |
2/2✓ Branch 0 taken 4373016 times.
✓ Branch 1 taken 546627 times.
|
4919643 | for(int32_t q = 0; q < 8; ++q) |
| 12934 | { | ||
| 12935 |
2/2✓ Branch 0 taken 143880 times.
✓ Branch 1 taken 4229136 times.
|
4373016 | if(zmeta_version < 3) |
| 12936 | { | ||
| 12937 |
2/2✓ Branch 0 taken 143880 times.
✓ Branch 1 taken 4748040 times.
|
4891920 | for(int32_t c = 0; c < 33; ++c) |
| 12938 | { | ||
| 12939 |
2/4✓ Branch 0 taken 4748040 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4748040 times.
✗ Branch 3 not taken.
|
4748040 | if(!p_getc(&(b33[c]),f)) |
| 12940 | { | ||
| 12941 | ✗ | return qe_invalid; | |
| 12942 | } | ||
| 12943 | 4748040 | } | |
| 12944 |
1/2✓ Branch 0 taken 143880 times.
✗ Branch 1 not taken.
|
143880 | temp_meta.run_idens[q].assign(b33); |
| 12945 | 143880 | } | |
| 12946 | else | ||
| 12947 | { | ||
| 12948 |
2/4✓ Branch 0 taken 4229136 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4229136 times.
✗ Branch 3 not taken.
|
4229136 | if(!p_getcstr(&temp_meta.run_idens[q],f)) |
| 12949 | { | ||
| 12950 | ✗ | return qe_invalid; | |
| 12951 | } | ||
| 12952 | } | ||
| 12953 | 4373016 | } | |
| 12954 | |||
| 12955 |
2/2✓ Branch 0 taken 546627 times.
✓ Branch 1 taken 4373016 times.
|
4919643 | for(int32_t q = 0; q < 8; ++q) |
| 12956 | { | ||
| 12957 |
2/4✓ Branch 0 taken 4373016 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4373016 times.
✗ Branch 3 not taken.
|
4373016 | if(!p_getc(&(temp_meta.run_types[q]),f)) |
| 12958 | { | ||
| 12959 | ✗ | return qe_invalid; | |
| 12960 | } | ||
| 12961 | 4373016 | } | |
| 12962 | |||
| 12963 |
2/4✓ Branch 0 taken 546627 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 546627 times.
✗ Branch 3 not taken.
|
546627 | if(!p_getc(&(temp_meta.flags),f)) |
| 12964 | { | ||
| 12965 | ✗ | return qe_invalid; | |
| 12966 | } | ||
| 12967 | |||
| 12968 |
2/4✓ Branch 0 taken 546627 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 546627 times.
✗ Branch 3 not taken.
|
546627 | if(!p_igetw(&(temp_meta.compiler_v1),f)) |
| 12969 | { | ||
| 12970 | ✗ | return qe_invalid; | |
| 12971 | } | ||
| 12972 | |||
| 12973 |
2/4✓ Branch 0 taken 546627 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 546627 times.
✗ Branch 3 not taken.
|
546627 | if(!p_igetw(&(temp_meta.compiler_v2),f)) |
| 12974 | { | ||
| 12975 | ✗ | return qe_invalid; | |
| 12976 | } | ||
| 12977 | |||
| 12978 |
2/4✓ Branch 0 taken 546627 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 546627 times.
✗ Branch 3 not taken.
|
546627 | if(!p_igetw(&(temp_meta.compiler_v3),f)) |
| 12979 | { | ||
| 12980 | ✗ | return qe_invalid; | |
| 12981 | } | ||
| 12982 | |||
| 12983 |
2/4✓ Branch 0 taken 546627 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 546627 times.
✗ Branch 3 not taken.
|
546627 | if(!p_igetw(&(temp_meta.compiler_v4),f)) |
| 12984 | { | ||
| 12985 | ✗ | return qe_invalid; | |
| 12986 | } | ||
| 12987 | |||
| 12988 |
2/2✓ Branch 0 taken 17985 times.
✓ Branch 1 taken 528642 times.
|
546627 | if(zmeta_version == 2) |
| 12989 | { | ||
| 12990 |
2/2✓ Branch 0 taken 17985 times.
✓ Branch 1 taken 593505 times.
|
611490 | for(int32_t c = 0; c < 33; ++c) |
| 12991 | { | ||
| 12992 |
2/4✓ Branch 0 taken 593505 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 593505 times.
✗ Branch 3 not taken.
|
593505 | if(!p_getc(&b33[c],f)) |
| 12993 | { | ||
| 12994 | ✗ | return qe_invalid; | |
| 12995 | } | ||
| 12996 | 593505 | } | |
| 12997 |
1/2✓ Branch 0 taken 17985 times.
✗ Branch 1 not taken.
|
17985 | temp_meta.script_name.assign(b33); |
| 12998 | |||
| 12999 |
2/2✓ Branch 0 taken 17985 times.
✓ Branch 1 taken 593505 times.
|
611490 | for(int32_t c = 0; c < 33; ++c) |
| 13000 | { | ||
| 13001 |
2/4✓ Branch 0 taken 593505 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 593505 times.
✗ Branch 3 not taken.
|
593505 | if(!p_getc(&b33[c],f)) |
| 13002 | { | ||
| 13003 | ✗ | return qe_invalid; | |
| 13004 | } | ||
| 13005 | 593505 | } | |
| 13006 |
1/2✓ Branch 0 taken 17985 times.
✗ Branch 1 not taken.
|
17985 | temp_meta.author.assign(b33); |
| 13007 | 17985 | } | |
| 13008 |
1/2✓ Branch 0 taken 528642 times.
✗ Branch 1 not taken.
|
528642 | else if(zmeta_version > 2) |
| 13009 | { | ||
| 13010 |
2/4✓ Branch 0 taken 528642 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 528642 times.
✗ Branch 3 not taken.
|
528642 | if(!p_getcstr(&temp_meta.script_name,f)) |
| 13011 | ✗ | return qe_invalid; | |
| 13012 |
2/4✓ Branch 0 taken 528642 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 528642 times.
✗ Branch 3 not taken.
|
528642 | if(!p_getcstr(&temp_meta.author,f)) |
| 13013 | ✗ | return qe_invalid; | |
| 13014 | 528642 | auto num_meta_attrib = (zmeta_version < 5 ? 4 : 10); | |
| 13015 |
2/2✓ Branch 0 taken 5286420 times.
✓ Branch 1 taken 528642 times.
|
5815062 | for(auto q = 0; q < num_meta_attrib; ++q) |
| 13016 | { | ||
| 13017 |
2/4✓ Branch 0 taken 5286420 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5286420 times.
✗ Branch 3 not taken.
|
5286420 | if(!p_getcstr(&temp_meta.attributes[q],f)) |
| 13018 | ✗ | return qe_invalid; | |
| 13019 |
2/4✓ Branch 0 taken 5286420 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5286420 times.
✗ Branch 3 not taken.
|
5286420 | if(!p_getwstr(&temp_meta.attributes_help[q],f)) |
| 13020 | ✗ | return qe_invalid; | |
| 13021 | 5286420 | } | |
| 13022 |
2/2✓ Branch 0 taken 4229136 times.
✓ Branch 1 taken 528642 times.
|
4757778 | for(auto q = 0; q < 8; ++q) |
| 13023 | { | ||
| 13024 |
2/4✓ Branch 0 taken 4229136 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4229136 times.
✗ Branch 3 not taken.
|
4229136 | if(!p_getcstr(&temp_meta.attribytes[q],f)) |
| 13025 | ✗ | return qe_invalid; | |
| 13026 |
2/4✓ Branch 0 taken 4229136 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4229136 times.
✗ Branch 3 not taken.
|
4229136 | if(!p_getwstr(&temp_meta.attribytes_help[q],f)) |
| 13027 | ✗ | return qe_invalid; | |
| 13028 | 4229136 | } | |
| 13029 |
2/2✓ Branch 0 taken 4229136 times.
✓ Branch 1 taken 528642 times.
|
4757778 | for(auto q = 0; q < 8; ++q) |
| 13030 | { | ||
| 13031 |
2/4✓ Branch 0 taken 4229136 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4229136 times.
✗ Branch 3 not taken.
|
4229136 | if(!p_getcstr(&temp_meta.attrishorts[q],f)) |
| 13032 | ✗ | return qe_invalid; | |
| 13033 |
2/4✓ Branch 0 taken 4229136 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4229136 times.
✗ Branch 3 not taken.
|
4229136 | if(!p_getwstr(&temp_meta.attrishorts_help[q],f)) |
| 13034 | ✗ | return qe_invalid; | |
| 13035 | 4229136 | } | |
| 13036 |
2/2✓ Branch 0 taken 8458272 times.
✓ Branch 1 taken 528642 times.
|
8986914 | for(auto q = 0; q < 16; ++q) |
| 13037 | { | ||
| 13038 |
2/4✓ Branch 0 taken 8458272 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8458272 times.
✗ Branch 3 not taken.
|
8458272 | if(!p_getcstr(&temp_meta.usrflags[q],f)) |
| 13039 | ✗ | return qe_invalid; | |
| 13040 |
2/4✓ Branch 0 taken 8458272 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8458272 times.
✗ Branch 3 not taken.
|
8458272 | if(!p_getwstr(&temp_meta.usrflags_help[q],f)) |
| 13041 | ✗ | return qe_invalid; | |
| 13042 | 8458272 | } | |
| 13043 | 528642 | } | |
| 13044 |
2/2✓ Branch 0 taken 528642 times.
✓ Branch 1 taken 17985 times.
|
546627 | if(zmeta_version > 3) |
| 13045 | { | ||
| 13046 |
2/2✓ Branch 0 taken 4229136 times.
✓ Branch 1 taken 528642 times.
|
4757778 | for(auto q = 0; q < 8; ++q) |
| 13047 | { | ||
| 13048 |
2/4✓ Branch 0 taken 4229136 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4229136 times.
✗ Branch 3 not taken.
|
4229136 | if(!p_getcstr(&temp_meta.initd[q],f)) |
| 13049 | ✗ | return qe_invalid; | |
| 13050 |
2/4✓ Branch 0 taken 4229136 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4229136 times.
✗ Branch 3 not taken.
|
4229136 | if(!p_getwstr(&temp_meta.initd_help[q],f)) |
| 13051 | ✗ | return qe_invalid; | |
| 13052 | 4229136 | } | |
| 13053 |
2/2✓ Branch 0 taken 4229136 times.
✓ Branch 1 taken 528642 times.
|
4757778 | for(auto q = 0; q < 8; ++q) |
| 13054 | { | ||
| 13055 |
2/4✓ Branch 0 taken 4229136 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4229136 times.
✗ Branch 3 not taken.
|
4229136 | if(!p_getc(&temp_meta.initd_type[q],f)) |
| 13056 | ✗ | return qe_invalid; | |
| 13057 | 4229136 | } | |
| 13058 | 528642 | } | |
| 13059 | else | ||
| 13060 | { | ||
| 13061 |
2/2✓ Branch 0 taken 143880 times.
✓ Branch 1 taken 17985 times.
|
161865 | for(auto q = 0; q < 8; ++q) |
| 13062 | { | ||
| 13063 |
1/2✓ Branch 0 taken 143880 times.
✗ Branch 1 not taken.
|
143880 | temp_meta.initd[q] = temp_meta.run_idens[q]; |
| 13064 | 143880 | } | |
| 13065 | } | ||
| 13066 | |||
| 13067 |
1/2✓ Branch 0 taken 546627 times.
✗ Branch 1 not taken.
|
546627 | script->meta = temp_meta; |
| 13068 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 546627 times.
✓ Branch 2 taken 291627 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 291627 times.
✗ Branch 5 not taken.
|
838254 | } else script->meta = {}; |
| 13069 | |||
| 13070 |
2/2✓ Branch 0 taken 93289349 times.
✓ Branch 1 taken 381299 times.
|
93670648 | for(int32_t j=0; j<num_commands; j++) |
| 13071 | { | ||
| 13072 |
1/2✓ Branch 0 taken 93289349 times.
✗ Branch 1 not taken.
|
93289349 | auto& sc = zasm.emplace_back(); |
| 13073 |
2/4✓ Branch 0 taken 93289349 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 93289349 times.
✗ Branch 3 not taken.
|
93289349 | if(!p_igetw(&sc.command,f)) |
| 13074 | { | ||
| 13075 | ✗ | return qe_invalid; | |
| 13076 | } | ||
| 13077 | |||
| 13078 |
2/2✓ Branch 0 taken 92832394 times.
✓ Branch 1 taken 456955 times.
|
93289349 | if(sc.command == 0xFFFF) |
| 13079 | { | ||
| 13080 | 456955 | break; | |
| 13081 | } | ||
| 13082 | |||
| 13083 |
2/4✓ Branch 0 taken 92832394 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 92832394 times.
✗ Branch 3 not taken.
|
92832394 | if(!p_igetl(&sc.arg1,f)) |
| 13084 | { | ||
| 13085 | ✗ | return qe_invalid; | |
| 13086 | } | ||
| 13087 | |||
| 13088 |
2/4✓ Branch 0 taken 92832394 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 92832394 times.
✗ Branch 3 not taken.
|
92832394 | if(!p_igetl(&sc.arg2,f)) |
| 13089 | { | ||
| 13090 | ✗ | return qe_invalid; | |
| 13091 | } | ||
| 13092 | |||
| 13093 |
2/2✓ Branch 0 taken 2502470 times.
✓ Branch 1 taken 90329924 times.
|
92832394 | if(s_version >= 24) |
| 13094 |
2/4✓ Branch 0 taken 2502470 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2502470 times.
✗ Branch 3 not taken.
|
2502470 | if(!p_igetl(&sc.arg3,f)) |
| 13095 | ✗ | return qe_invalid; | |
| 13096 | |||
| 13097 |
2/2✓ Branch 0 taken 8757560 times.
✓ Branch 1 taken 84074834 times.
|
92832394 | if(s_version >= 21) |
| 13098 | { | ||
| 13099 | 8757560 | uint32_t sz = 0; | |
| 13100 |
2/4✓ Branch 0 taken 8757560 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8757560 times.
✗ Branch 3 not taken.
|
8757560 | if(!p_igetl(&sz,f)) |
| 13101 | { | ||
| 13102 | ✗ | return qe_invalid; | |
| 13103 | } | ||
| 13104 |
2/2✓ Branch 0 taken 38113 times.
✓ Branch 1 taken 8719447 times.
|
8757560 | if(sz) //string found |
| 13105 | { | ||
| 13106 |
1/2✓ Branch 0 taken 38113 times.
✗ Branch 1 not taken.
|
38113 | sc.strptr = new std::string(); |
| 13107 | char dummy; | ||
| 13108 |
2/2✓ Branch 0 taken 1388519 times.
✓ Branch 1 taken 38113 times.
|
1426632 | for(size_t q = 0; q < sz; ++q) |
| 13109 | { | ||
| 13110 |
2/4✓ Branch 0 taken 1388519 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1388519 times.
✗ Branch 3 not taken.
|
1388519 | if(!p_getc(&dummy,f)) |
| 13111 | { | ||
| 13112 | ✗ | return qe_invalid; | |
| 13113 | } | ||
| 13114 |
1/2✓ Branch 0 taken 1388519 times.
✗ Branch 1 not taken.
|
1388519 | sc.strptr->push_back(dummy); |
| 13115 | 1388519 | } | |
| 13116 | 38113 | } | |
| 13117 |
2/4✓ Branch 0 taken 8757560 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8757560 times.
✗ Branch 3 not taken.
|
8757560 | if(!p_igetl(&sz,f)) |
| 13118 | { | ||
| 13119 | ✗ | return qe_invalid; | |
| 13120 | } | ||
| 13121 |
2/2✓ Branch 0 taken 2678 times.
✓ Branch 1 taken 8754882 times.
|
8757560 | if(sz) //vector found |
| 13122 | { | ||
| 13123 |
1/2✓ Branch 0 taken 2678 times.
✗ Branch 1 not taken.
|
2678 | sc.vecptr = new std::vector<int32_t>(); |
| 13124 | int32_t dummy; | ||
| 13125 |
2/2✓ Branch 0 taken 15728 times.
✓ Branch 1 taken 2678 times.
|
18406 | for(size_t q = 0; q < sz; ++q) |
| 13126 | { | ||
| 13127 |
2/4✓ Branch 0 taken 15728 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15728 times.
✗ Branch 3 not taken.
|
15728 | if(!p_igetl(&dummy,f)) |
| 13128 | { | ||
| 13129 | ✗ | return qe_invalid; | |
| 13130 | } | ||
| 13131 |
1/2✓ Branch 0 taken 15728 times.
✗ Branch 1 not taken.
|
15728 | sc.vecptr->push_back(dummy); |
| 13132 | 15728 | } | |
| 13133 | 2678 | } | |
| 13134 | 8757560 | } | |
| 13135 | 92832394 | } | |
| 13136 | |||
| 13137 | // If the first command is unknown, invalidate the whole thing. | ||
| 13138 | // Saw this for https://www.purezc.net/index.php?page=quests&id=411 hero script 0 | ||
| 13139 |
5/6✓ Branch 0 taken 456955 times.
✓ Branch 1 taken 381299 times.
✓ Branch 2 taken 443548 times.
✓ Branch 3 taken 13407 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 443548 times.
|
838254 | if (!zasm.empty() && zasm[0].command >= NUMCOMMANDS && zasm[0].command != 0xFFFF) |
| 13140 | { | ||
| 13141 | ✗ | al_trace("Warning: found script with bad instruction, disabling script: %s %d\n", ScriptTypeToString(script->id.type), script->id.index); | |
| 13142 | ✗ | zasm.clear(); | |
| 13143 | ✗ | } | |
| 13144 | |||
| 13145 | 838254 | zasm_script_id id = zasm_scripts.size(); | |
| 13146 |
3/6✓ Branch 0 taken 838254 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 838254 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 838254 times.
✗ Branch 5 not taken.
|
838254 | auto& zs = zasm_scripts.emplace_back(std::make_shared<zasm_script>(id, script->name(), std::move(zasm))); |
| 13147 | 838254 | script->zasm_script = zs; | |
| 13148 | |||
| 13149 | 838254 | return 0; | |
| 13150 | 838254 | } | |
| 13151 | |||
| 13152 | extern SAMPLE customsfxdata[WAV_COUNT]; | ||
| 13153 | extern uint8_t customsfxflag[WAV_COUNT>>3]; | ||
| 13154 | extern int32_t sfxdat; | ||
| 13155 | extern DATAFILE *sfxdata; | ||
| 13156 | const char *old_sfx_string[Z35] = | ||
| 13157 | { | ||
| 13158 | "Arrow", "Sword beam", "Bomb blast", "Boomerang", "Subscreen cursor", | ||
| 13159 | "Shield is hit", "Item chime", "Roar (Dodongo, Gohma)", "Shutter", "Enemy dies", | ||
| 13160 | "Enemy is hit", "Low hearts warning", "Fire", "Ganon's fanfare", "Boss is hit", "Hammer", | ||
| 13161 | "Hookshot", "Message", "Player is hit", "Item fanfare", "Bomb placed", "Item pickup", | ||
| 13162 | "Refill", "Roar (Aquamentus, Gleeok, Ganon)", "Item pickup 2", "Ocean ambience", | ||
| 13163 | "Secret chime", "Player dies", "Stairs", "Sword", "Roar (Manhandla, Digdogger, Patra)", | ||
| 13164 | "Wand magic", "Whistle", "Zelda's fanfare", "Charging weapon", "Charging weapon 2", | ||
| 13165 | "Divine Fire", "Enemy falls from ceiling", "Divine Escape", "Fireball", "Tall Grass slashed", | ||
| 13166 | "Pound pounded", "Hover Boots", "Ice magic", "Jump", "Lens of Truth off", "Lens of Truth on", | ||
| 13167 | "Divine Protection shield", "Divine Protection 2", "Push block", "Rock", "Spell rocket down", | ||
| 13168 | "Spell rocket up", "Sword spin attack", "Splash", "Summon magic", "Sword tapping", | ||
| 13169 | "Sword tapping (secret)", "Whistle whirlwind", "Cane of Byrna orbit" | ||
| 13170 | }; | ||
| 13171 | char *sfx_string[WAV_COUNT]; | ||
| 13172 | |||
| 13173 | 332 | int32_t readsfx(PACKFILE *f, zquestheader *Header) | |
| 13174 | { | ||
| 13175 | //these are here to bypass compiler warnings about unused arguments | ||
| 13176 | 332 | Header=Header; | |
| 13177 | |||
| 13178 | int32_t dummy; | ||
| 13179 | 332 | word s_version=0, s_cversion=0; | |
| 13180 | //int32_t ret; | ||
| 13181 | 332 | SAMPLE temp_sample = {}; | |
| 13182 | 332 | temp_sample.loop_start=0; | |
| 13183 | 332 | temp_sample.loop_end=0; | |
| 13184 | 332 | temp_sample.param=0; | |
| 13185 | |||
| 13186 | //section version info | ||
| 13187 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | if(!p_igetw(&s_version,f)) |
| 13188 | { | ||
| 13189 | ✗ | return qe_invalid; | |
| 13190 | } | ||
| 13191 | |||
| 13192 | 332 | FFCore.quest_format[vSFX] = s_version; | |
| 13193 | |||
| 13194 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_igetw(&s_cversion,f)) |
| 13195 | { | ||
| 13196 | ✗ | return qe_invalid; | |
| 13197 | } | ||
| 13198 | |||
| 13199 | //section size | ||
| 13200 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_igetl(&dummy,f)) |
| 13201 | { | ||
| 13202 | ✗ | return qe_invalid; | |
| 13203 | } | ||
| 13204 | |||
| 13205 | /* HIGHLY UNORTHODOX UPDATING THING, by L | ||
| 13206 | * This fixes quests made before revision 411 (such as the 'Lost Isle Build'), | ||
| 13207 | * where the meaning of GOTOLESS changed. It also coincided with V_SFX | ||
| 13208 | * changing from 1 to 2. | ||
| 13209 | */ | ||
| 13210 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(s_version < 2) |
| 13211 | ✗ | set_qr(qr_GOTOLESSNOTEQUAL,1); | |
| 13212 | |||
| 13213 | /* End highly unorthodox updating thing */ | ||
| 13214 | |||
| 13215 | 332 | int32_t wavcount = WAV_COUNT; | |
| 13216 | |||
| 13217 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(s_version < 6) |
| 13218 | ✗ | wavcount = 128; | |
| 13219 | |||
| 13220 | uint8_t tempflag[WAV_COUNT>>3]; | ||
| 13221 | |||
| 13222 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | if(s_version < 4) |
| 13223 | { | ||
| 13224 | ✗ | memset(tempflag, 0xFF, WAV_COUNT>>3); | |
| 13225 | ✗ | } | |
| 13226 | else | ||
| 13227 | { | ||
| 13228 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(s_version < 6) |
| 13229 | ✗ | memset(tempflag, 0, WAV_COUNT>>3); | |
| 13230 | |||
| 13231 |
2/2✓ Branch 0 taken 10624 times.
✓ Branch 1 taken 332 times.
|
10956 | for(int32_t i=0; i<(wavcount>>3); i++) |
| 13232 | { | ||
| 13233 | 10624 | p_getc(&tempflag[i], f); | |
| 13234 | 10624 | } | |
| 13235 | |||
| 13236 | } | ||
| 13237 | |||
| 13238 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(s_version>4) |
| 13239 | { | ||
| 13240 |
2/2✓ Branch 0 taken 84660 times.
✓ Branch 1 taken 332 times.
|
84992 | for(int32_t i=1; i<WAV_COUNT; i++) |
| 13241 | { | ||
| 13242 | 84660 | sprintf(sfx_string[i],"s%03d",i); | |
| 13243 | |||
| 13244 |
2/2✓ Branch 0 taken 64740 times.
✓ Branch 1 taken 19920 times.
|
84660 | if((i<Z35)) |
| 13245 | 19920 | strcpy(sfx_string[i], old_sfx_string[i-1]); | |
| 13246 | |||
| 13247 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 84660 times.
|
84660 | if(i>=wavcount) |
| 13248 | ✗ | continue; | |
| 13249 |
2/2✓ Branch 0 taken 16667 times.
✓ Branch 1 taken 67993 times.
|
84660 | if(get_bit(tempflag, i-1)) |
| 13250 | { | ||
| 13251 | char tempname[36]; | ||
| 13252 | |||
| 13253 |
1/2✓ Branch 0 taken 16667 times.
✗ Branch 1 not taken.
|
16667 | if(!pfread(tempname, 36, f)) |
| 13254 | { | ||
| 13255 | ✗ | return qe_invalid; | |
| 13256 | } | ||
| 13257 | |||
| 13258 | 16667 | sfx_string[i][0] = '\0'; | |
| 13259 | 16667 | strncat(sfx_string[i], tempname, 36 - 1); | |
| 13260 | 16667 | } | |
| 13261 | else | ||
| 13262 | { | ||
| 13263 | 67993 | sprintf(sfx_string[i],"s%03d",i); | |
| 13264 | |||
| 13265 |
2/2✓ Branch 0 taken 58833 times.
✓ Branch 1 taken 9160 times.
|
67993 | if(i<Z35) |
| 13266 | 9160 | strcpy(sfx_string[i], old_sfx_string[i-1]); | |
| 13267 | 67993 | sfx_string[i][35] = 0; //Force NULL Termination | |
| 13268 | } | ||
| 13269 | 84660 | } | |
| 13270 | 332 | } | |
| 13271 | else | ||
| 13272 | { | ||
| 13273 | ✗ | for(int32_t i=1; i<WAV_COUNT; i++) | |
| 13274 | { | ||
| 13275 | ✗ | sprintf(sfx_string[i],"s%03d",i); | |
| 13276 | |||
| 13277 | ✗ | if(i<Z35) | |
| 13278 | ✗ | strcpy(sfx_string[i], old_sfx_string[i-1]); | |
| 13279 | ✗ | } | |
| 13280 | } | ||
| 13281 | |||
| 13282 | //finally... section data | ||
| 13283 |
2/2✓ Branch 0 taken 84660 times.
✓ Branch 1 taken 332 times.
|
84992 | for(int32_t i=1; i<wavcount; i++) |
| 13284 | { | ||
| 13285 |
2/2✓ Branch 0 taken 16667 times.
✓ Branch 1 taken 67993 times.
|
84660 | if(get_bit(tempflag, i-1)) |
| 13286 | { | ||
| 13287 | |||
| 13288 |
1/2✓ Branch 0 taken 16667 times.
✗ Branch 1 not taken.
|
16667 | if(!p_igetl(&dummy,f)) |
| 13289 | { | ||
| 13290 | ✗ | return qe_invalid; | |
| 13291 | } | ||
| 13292 | |||
| 13293 | 16667 | (temp_sample.bits) = dummy; | |
| 13294 | |||
| 13295 |
1/2✓ Branch 0 taken 16667 times.
✗ Branch 1 not taken.
|
16667 | if(!p_igetl(&dummy,f)) |
| 13296 | { | ||
| 13297 | ✗ | return qe_invalid; | |
| 13298 | } | ||
| 13299 | |||
| 13300 | 16667 | (temp_sample.stereo) = dummy; | |
| 13301 | |||
| 13302 |
1/2✓ Branch 0 taken 16667 times.
✗ Branch 1 not taken.
|
16667 | if(!p_igetl(&dummy,f)) |
| 13303 | { | ||
| 13304 | ✗ | return qe_invalid; | |
| 13305 | } | ||
| 13306 | |||
| 13307 | 16667 | (temp_sample.freq) = dummy; | |
| 13308 | |||
| 13309 |
1/2✓ Branch 0 taken 16667 times.
✗ Branch 1 not taken.
|
16667 | if(!p_igetl(&dummy,f)) |
| 13310 | { | ||
| 13311 | ✗ | return qe_invalid; | |
| 13312 | } | ||
| 13313 | |||
| 13314 | 16667 | (temp_sample.priority) = dummy; | |
| 13315 | |||
| 13316 |
1/2✓ Branch 0 taken 16667 times.
✗ Branch 1 not taken.
|
16667 | if(!p_igetl(&(temp_sample.len),f)) |
| 13317 | { | ||
| 13318 | ✗ | return qe_invalid; | |
| 13319 | } | ||
| 13320 | |||
| 13321 |
1/2✓ Branch 0 taken 16667 times.
✗ Branch 1 not taken.
|
16667 | if(!p_igetl(&(temp_sample.loop_start),f)) |
| 13322 | { | ||
| 13323 | ✗ | return qe_invalid; | |
| 13324 | } | ||
| 13325 | |||
| 13326 |
1/2✓ Branch 0 taken 16667 times.
✗ Branch 1 not taken.
|
16667 | if(!p_igetl(&(temp_sample.loop_end),f)) |
| 13327 | { | ||
| 13328 | ✗ | return qe_invalid; | |
| 13329 | } | ||
| 13330 | |||
| 13331 |
1/2✓ Branch 0 taken 16667 times.
✗ Branch 1 not taken.
|
16667 | if(!p_igetl(&(temp_sample.param),f)) |
| 13332 | { | ||
| 13333 | ✗ | return qe_invalid; | |
| 13334 | } | ||
| 13335 | |||
| 13336 | 16667 | auto len = (temp_sample.bits==8?1:2)*(temp_sample.stereo==0?1:2)*temp_sample.len; | |
| 13337 | #ifdef ZC_FUZZ | ||
| 13338 | const int32_t sfx_limit = 100000; | ||
| 13339 | if (len < 0 || len > sfx_limit) | ||
| 13340 | { | ||
| 13341 | return qe_invalid; | ||
| 13342 | } | ||
| 13343 | #endif | ||
| 13344 | 16667 | temp_sample.data = calloc(len,1); | |
| 13345 | |||
| 13346 |
1/2✓ Branch 0 taken 16667 times.
✗ Branch 1 not taken.
|
16667 | if(s_version < 3) |
| 13347 | ✗ | len = (temp_sample.bits==8?1:2)*temp_sample.len; | |
| 13348 | |||
| 13349 | //old-style, non-portable loading (Bad Allegro! Bad!!) -DD | ||
| 13350 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16667 times.
|
16667 | if(s_version < 2) |
| 13351 | { | ||
| 13352 | ✗ | if(!pfread(temp_sample.data, len,f)) | |
| 13353 | { | ||
| 13354 | ✗ | return qe_invalid; | |
| 13355 | } | ||
| 13356 | ✗ | } | |
| 13357 | else | ||
| 13358 | { | ||
| 13359 | //re-endianfy the data | ||
| 13360 | 16667 | int32_t wordstoread = len / sizeof(word); | |
| 13361 | |||
| 13362 |
2/2✓ Branch 0 taken 478570865 times.
✓ Branch 1 taken 16667 times.
|
478587532 | for(int32_t j=0; j<wordstoread; j++) |
| 13363 | { | ||
| 13364 | word temp; | ||
| 13365 | |||
| 13366 |
1/2✓ Branch 0 taken 478570865 times.
✗ Branch 1 not taken.
|
478570865 | if(!p_igetw(&temp, f)) |
| 13367 | { | ||
| 13368 | ✗ | return qe_invalid; | |
| 13369 | } | ||
| 13370 | |||
| 13371 | 478570865 | ((word *)temp_sample.data)[j] = temp; | |
| 13372 | 478570865 | } | |
| 13373 | } | ||
| 13374 | 16667 | } | |
| 13375 |
2/2✓ Branch 0 taken 9160 times.
✓ Branch 1 taken 58833 times.
|
67993 | else if(i < Z35) |
| 13376 | { | ||
| 13377 | 9160 | SAMPLE* datsamp = (SAMPLE*)(sfxdata[i].dat); | |
| 13378 | 9160 | memcpy(&temp_sample, datsamp, sizeof(SAMPLE)); | |
| 13379 | 9160 | set_bit(tempflag, i-1, 1); | |
| 13380 | 9160 | int32_t len = (temp_sample.bits==8?1:2)*(temp_sample.stereo==0?1:2)*temp_sample.len; | |
| 13381 | 9160 | temp_sample.data = calloc(len,1); | |
| 13382 | 9160 | memcpy(temp_sample.data, datsamp->data, len); | |
| 13383 | 9160 | } | |
| 13384 | 58833 | else continue; | |
| 13385 | |||
| 13386 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 25827 times.
|
25827 | if(customsfxdata[i].data!=NULL) |
| 13387 | { | ||
| 13388 | // delete [] customsfxdata[i].data; | ||
| 13389 | 25827 | free(customsfxdata[i].data); | |
| 13390 | 25827 | } | |
| 13391 | |||
| 13392 | // customsfxdata[i].data = new byte[(temp_sample.bits==8?1:2)*temp_sample.len]; | ||
| 13393 | 25827 | int32_t len2 = (temp_sample.bits==8?1:2)*(temp_sample.stereo==0?1:2)*temp_sample.len; | |
| 13394 | 25827 | customsfxdata[i].data = calloc(len2,1); | |
| 13395 | 25827 | customsfxdata[i].bits = temp_sample.bits; | |
| 13396 | 25827 | customsfxdata[i].stereo = temp_sample.stereo; | |
| 13397 | 25827 | customsfxdata[i].freq = temp_sample.freq; | |
| 13398 | 25827 | customsfxdata[i].priority = temp_sample.priority; | |
| 13399 | 25827 | customsfxdata[i].len = temp_sample.len; | |
| 13400 | 25827 | customsfxdata[i].loop_start = temp_sample.loop_start; | |
| 13401 | 25827 | customsfxdata[i].loop_end = temp_sample.loop_end; | |
| 13402 | 25827 | customsfxdata[i].param = temp_sample.param; | |
| 13403 | 25827 | int32_t cpylen = len2; | |
| 13404 | |||
| 13405 |
1/2✓ Branch 0 taken 25827 times.
✗ Branch 1 not taken.
|
25827 | if(s_version<3) |
| 13406 | { | ||
| 13407 | ✗ | cpylen = (temp_sample.bits==8?1:2)*temp_sample.len; | |
| 13408 | ✗ | al_trace("WARNING: Quest SFX %d is in stereo, and may be corrupt.\n",i); | |
| 13409 | ✗ | } | |
| 13410 | |||
| 13411 | 25827 | memcpy(customsfxdata[i].data,temp_sample.data,cpylen); | |
| 13412 | |||
| 13413 | 25827 | free(temp_sample.data); | |
| 13414 | 25827 | } | |
| 13415 | |||
| 13416 | 332 | memcpy(customsfxflag, tempflag, WAV_COUNT>>3); | |
| 13417 | |||
| 13418 | 332 | sfxdat=0; | |
| 13419 | 332 | return 0; | |
| 13420 | 332 | } | |
| 13421 | |||
| 13422 | 414 | void setupsfx() | |
| 13423 | { | ||
| 13424 |
2/2✓ Branch 0 taken 105570 times.
✓ Branch 1 taken 414 times.
|
105984 | for(int32_t i=1; i<WAV_COUNT; i++) |
| 13425 | { | ||
| 13426 | 105570 | sprintf(sfx_string[i],"s%03d",i); | |
| 13427 | |||
| 13428 |
2/2✓ Branch 0 taken 80730 times.
✓ Branch 1 taken 24840 times.
|
105570 | if(i<Z35) |
| 13429 | { | ||
| 13430 | 24840 | strcpy(sfx_string[i], old_sfx_string[i-1]); | |
| 13431 | 24840 | } | |
| 13432 | |||
| 13433 | 105570 | memset(customsfxflag, 0, WAV_COUNT>>3); | |
| 13434 | |||
| 13435 | 105570 | int32_t j=i; | |
| 13436 | |||
| 13437 |
2/2✓ Branch 0 taken 25254 times.
✓ Branch 1 taken 80316 times.
|
105570 | if(i>Z35) |
| 13438 | { | ||
| 13439 | 80316 | i=Z35; | |
| 13440 | 80316 | } | |
| 13441 | |||
| 13442 | 105570 | SAMPLE *temp_sample = (SAMPLE *)sfxdata[i].dat; | |
| 13443 | |||
| 13444 |
2/2✓ Branch 0 taken 80070 times.
✓ Branch 1 taken 25500 times.
|
105570 | if(customsfxdata[j].data!=NULL) |
| 13445 | { | ||
| 13446 | // delete [] customsfxdata[j].data; | ||
| 13447 | 25500 | free(customsfxdata[j].data); | |
| 13448 | 25500 | } | |
| 13449 | |||
| 13450 | // customsfxdata[j].data = new byte[(temp_sample->bits==8?1:2)*temp_sample->len]; | ||
| 13451 | 105570 | customsfxdata[j].data = calloc((temp_sample->bits==8?1:2)*(temp_sample->stereo == 0 ? 1 : 2)*temp_sample->len,1); | |
| 13452 | 105570 | customsfxdata[j].bits = temp_sample->bits; | |
| 13453 | 105570 | customsfxdata[j].stereo = temp_sample->stereo; | |
| 13454 | 105570 | customsfxdata[j].freq = temp_sample->freq; | |
| 13455 | 105570 | customsfxdata[j].priority = temp_sample->priority; | |
| 13456 | 105570 | customsfxdata[j].len = temp_sample->len; | |
| 13457 | 105570 | customsfxdata[j].loop_start = temp_sample->loop_start; | |
| 13458 | 105570 | customsfxdata[j].loop_end = temp_sample->loop_end; | |
| 13459 | 105570 | customsfxdata[j].param = temp_sample->param; | |
| 13460 | 105570 | memcpy(customsfxdata[j].data, (temp_sample->data), (temp_sample->bits==8?1:2)*(temp_sample->stereo==0 ? 1 : 2)*temp_sample->len); | |
| 13461 | 105570 | i=j; | |
| 13462 | 105570 | } | |
| 13463 | 414 | } | |
| 13464 | |||
| 13465 | extern char *guy_string[eMAXGUYS]; | ||
| 13466 | extern const char *old_guy_string[OLDMAXGUYS]; | ||
| 13467 | |||
| 13468 | 414 | int32_t readguys(PACKFILE *f, zquestheader *Header) | |
| 13469 | { | ||
| 13470 |
2/2✓ Branch 0 taken 391 times.
✓ Branch 1 taken 23 times.
|
414 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_guys); |
| 13471 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 414 times.
|
414 | if (should_skip) return 0; |
| 13472 | |||
| 13473 | dword dummy; | ||
| 13474 | word guy_cversion; | ||
| 13475 | 414 | word guyversion=0; | |
| 13476 | |||
| 13477 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 391 times.
|
414 | if(Header->zelda_version >= 0x193) |
| 13478 | { | ||
| 13479 | //section version info | ||
| 13480 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | if(!p_igetw(&guyversion,f)) |
| 13481 | { | ||
| 13482 | ✗ | return qe_invalid; | |
| 13483 | } | ||
| 13484 | |||
| 13485 | 391 | FFCore.quest_format[vGuys] = guyversion; | |
| 13486 | |||
| 13487 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | if(!p_igetw(&guy_cversion,f)) |
| 13488 | { | ||
| 13489 | ✗ | return qe_invalid; | |
| 13490 | } | ||
| 13491 | 391 | al_trace("Guy CVersion is: %d\n", guy_cversion); | |
| 13492 | //section size | ||
| 13493 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | if(!p_igetl(&dummy,f)) |
| 13494 | { | ||
| 13495 | ✗ | return qe_invalid; | |
| 13496 | } | ||
| 13497 | 391 | } | |
| 13498 | |||
| 13499 |
2/2✓ Branch 0 taken 332 times.
✓ Branch 1 taken 82 times.
|
414 | if(guyversion > 3) |
| 13500 | { | ||
| 13501 |
2/2✓ Branch 0 taken 169984 times.
✓ Branch 1 taken 332 times.
|
170316 | for(int32_t i=0; i<MAXGUYS; i++) |
| 13502 | { | ||
| 13503 | char tempname[64]; | ||
| 13504 | |||
| 13505 | // rev. 1511 : guyversion = 23. upped to 512 editable enemies. -Gleeok | ||
| 13506 | // if guyversion < 23 then there is only 256 enemies in the packfile, so default the rest. | ||
| 13507 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 169984 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
169984 | if(guyversion < 23 && i >= OLDBETAMAXGUYS) |
| 13508 | { | ||
| 13509 | ✗ | memset(tempname, 0, sizeof(char)*64); | |
| 13510 | ✗ | sprintf(tempname, "e%03d", i); | |
| 13511 | ✗ | strcpy(guy_string[i], tempname); | |
| 13512 | |||
| 13513 | ✗ | continue; | |
| 13514 | } | ||
| 13515 | |||
| 13516 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!pfread(tempname, 64, f)) |
| 13517 | { | ||
| 13518 | ✗ | return qe_invalid; | |
| 13519 | } | ||
| 13520 | |||
| 13521 | // Don't retain names of uneditable enemy entries! | ||
| 13522 | // for version upgrade to 2.5 | ||
| 13523 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 169984 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
169984 | if(guyversion < 23 && i >= 177) |
| 13524 | { | ||
| 13525 | // some of the older builds have names such as 'zz123', | ||
| 13526 | // (this order gets messed up with some eXXX and some zzXXX) | ||
| 13527 | // so let's update to the newer naming convection. -Gleeok | ||
| 13528 | char tmpbuf[64]; | ||
| 13529 | ✗ | memset(tmpbuf, 0, sizeof(char)*64); | |
| 13530 | ✗ | sprintf(tmpbuf, "zz%03d", i); | |
| 13531 | |||
| 13532 | ✗ | if(memcmp(tempname, tmpbuf, size_t(5)) == 0) | |
| 13533 | { | ||
| 13534 | ✗ | memset(tempname, 0, sizeof(char)*64); | |
| 13535 | ✗ | sprintf(tempname, "e%03d", i); | |
| 13536 | ✗ | } | |
| 13537 | ✗ | } | |
| 13538 | |||
| 13539 |
6/6✓ Branch 0 taken 58764 times.
✓ Branch 1 taken 111220 times.
✓ Branch 2 taken 55776 times.
✓ Branch 3 taken 2988 times.
✓ Branch 4 taken 47943 times.
✓ Branch 5 taken 7833 times.
|
169984 | if(i >= OLDMAXGUYS || strlen(tempname)<1 || tempname[strlen(tempname)-1]!=' ') |
| 13540 | { | ||
| 13541 | 162151 | guy_string[i][0] = '\0'; | |
| 13542 | 162151 | strncat(guy_string[i], tempname, 64 - 1); | |
| 13543 | 162151 | } | |
| 13544 | else | ||
| 13545 | { | ||
| 13546 | 7833 | strcpy(guy_string[i],old_guy_string[i]); | |
| 13547 | } | ||
| 13548 | 169984 | } | |
| 13549 | 332 | } | |
| 13550 | else | ||
| 13551 | { | ||
| 13552 |
2/2✓ Branch 0 taken 41984 times.
✓ Branch 1 taken 82 times.
|
42066 | for(int32_t i=0; i<eMAXGUYS; i++) |
| 13553 | { | ||
| 13554 | 41984 | sprintf(guy_string[i],"zz%03d",i); | |
| 13555 | 41984 | } | |
| 13556 | |||
| 13557 |
2/2✓ Branch 0 taken 14514 times.
✓ Branch 1 taken 82 times.
|
14596 | for(int32_t i=0; i<OLDMAXGUYS; i++) |
| 13558 | { | ||
| 13559 | 14514 | strcpy(guy_string[i],old_guy_string[i]); | |
| 13560 | 14514 | } | |
| 13561 | } | ||
| 13562 | |||
| 13563 | |||
| 13564 | //finally... section data | ||
| 13565 | 414 | init_guys(guyversion); //using default data for now... | |
| 13566 | |||
| 13567 | // Goriya guy fix | ||
| 13568 |
3/6✓ Branch 0 taken 332 times.
✓ Branch 1 taken 82 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 332 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
414 | if((Header->zelda_version < 0x211)||((Header->zelda_version == 0x211)&&(Header->build<7))) |
| 13569 | { | ||
| 13570 |
2/2✓ Branch 0 taken 22 times.
✓ Branch 1 taken 60 times.
|
82 | if(get_qr(qr_NEWENEMYTILES)) |
| 13571 | { | ||
| 13572 | 60 | guysbuf[gGORIYA].tile=130; | |
| 13573 | 60 | guysbuf[gGORIYA].e_tile=130; | |
| 13574 | 60 | } | |
| 13575 | 82 | } | |
| 13576 | |||
| 13577 |
2/2✓ Branch 0 taken 391 times.
✓ Branch 1 taken 23 times.
|
414 | if(Header->zelda_version < 0x193) |
| 13578 | { | ||
| 13579 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 5 times.
|
23 | if(get_bit(deprecated_rules,46)) |
| 13580 | { | ||
| 13581 | 5 | guysbuf[eDODONGO].cset=14; | |
| 13582 | 5 | guysbuf[eDODONGO].bosspal=spDIG; | |
| 13583 | 5 | } | |
| 13584 | 23 | } | |
| 13585 | // Not sure when this first changed, but it's necessary for 2.10, at least | ||
| 13586 | // @TODO: @BUG:1.92 - 1.84? Figure this out exactly for the final 2.50 release. | ||
| 13587 | //2.10 Fixes | ||
| 13588 |
3/6✓ Branch 0 taken 332 times.
✓ Branch 1 taken 82 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 332 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
414 | if((Header->zelda_version < 0x211)||((Header->zelda_version == 0x211)&&(Header->build<18))) |
| 13589 | { | ||
| 13590 | 82 | guysbuf[eWWIZ].editorflags |= ENEMY_FLAG5; | |
| 13591 | 82 | guysbuf[eMOLDORM].editorflags |= ENEMY_FLAG6; | |
| 13592 | 82 | guysbuf[eMANHAN].editorflags |= ENEMY_FLAG6; | |
| 13593 | 82 | guysbuf[eCENT1].attributes[2] = 1; | |
| 13594 | 82 | guysbuf[eCENT2].attributes[2] = 1; | |
| 13595 | 82 | } | |
| 13596 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 414 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
414 | if((Header->zelda_version <= 0x255) || (Header->zelda_version == 0x255 && Header->build < 47) ) |
| 13597 | { | ||
| 13598 | 414 | guysbuf[eWPOLSV].defense[edefWhistle] = ed1HKO; | |
| 13599 | 414 | } | |
| 13600 |
2/2✓ Branch 0 taken 332 times.
✓ Branch 1 taken 82 times.
|
414 | if(Header->zelda_version <= 0x210) |
| 13601 | { | ||
| 13602 | 82 | guysbuf[eGLEEOK1F].attributes[5] = 16; | |
| 13603 | 82 | guysbuf[eGLEEOK2F].attributes[5] = 16; | |
| 13604 | 82 | guysbuf[eGLEEOK3F].attributes[5] = 16; | |
| 13605 | 82 | guysbuf[eGLEEOK4F].attributes[5] = 16; | |
| 13606 | |||
| 13607 | 82 | guysbuf[eWIZ1].attributes[3] = 1; //only set the enemy that needs backward compat, not all of them. | |
| 13608 | 82 | guysbuf[eBATROBE].attributes[3] = 1; | |
| 13609 | //guysbuf[eSUMMONER].misc4 = 1; | ||
| 13610 | 82 | guysbuf[eWWIZ].attributes[3] = 1; | |
| 13611 | 82 | guysbuf[eDODONGO].deadsfx = 15; //In 2.10 and earlier, Dodongos used this as their death sound. | |
| 13612 | 82 | guysbuf[eDODONGOBS].deadsfx = 15; //In 2.10 and earlier, Dodongos used this as their death sound. | |
| 13613 | 82 | } | |
| 13614 |
2/2✓ Branch 0 taken 402 times.
✓ Branch 1 taken 12 times.
|
414 | if(Header->zelda_version == 0x190) |
| 13615 | { | ||
| 13616 | 12 | al_trace("Setting Tribble Properties for Version: %x", Header->zelda_version); | |
| 13617 | 12 | guysbuf[eKEESETRIB].attributes[2] = eVIRE; //1.90 and earlier, keese and gel tribbles grew up into | |
| 13618 | 12 | guysbuf[eGELTRIB].attributes[2] = eZOL; //normal vires, and zols -Z (16th January, 2019 ) | |
| 13619 | 12 | } | |
| 13620 | |||
| 13621 | // The versions here may not be correct | ||
| 13622 | // zelda_version>=0x211 handled at guyversion<24 | ||
| 13623 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 396 times.
|
414 | if(Header->zelda_version <= 0x190) |
| 13624 | { | ||
| 13625 | 18 | guysbuf[eCENT1].attributes[2] = 0; | |
| 13626 | 18 | guysbuf[eCENT2].attributes[2] = 0; | |
| 13627 | 18 | guysbuf[eMOLDORM].attributes[1] = 0; | |
| 13628 | //guysbuf[eKEESETRIB].misc3 = eVIRE; //1.90 and earlier, keese and gel tribbles grew up into | ||
| 13629 | //guysbuf[eGELTRIB].misc3 = eZOL; //normal vires, and zols -Z (16th January, 2019 ) | ||
| 13630 | 18 | } | |
| 13631 |
2/2✓ Branch 0 taken 332 times.
✓ Branch 1 taken 64 times.
|
396 | else if(Header->zelda_version <= 0x210) |
| 13632 | { | ||
| 13633 | 64 | guysbuf[eCENT1].attributes[2] = 1; | |
| 13634 | 64 | guysbuf[eCENT2].attributes[2] = 1; | |
| 13635 | 64 | guysbuf[eMOLDORM].attributes[1] = 0; | |
| 13636 | 64 | } | |
| 13637 | |||
| 13638 |
2/2✓ Branch 0 taken 332 times.
✓ Branch 1 taken 82 times.
|
414 | if ( Header->zelda_version < 0x211 ) //Default rest rates for phantom ghinis, peahats and keese in < 2.50 quests |
| 13639 | { | ||
| 13640 | 82 | guysbuf[eKEESE1].attributes[15] = 120; | |
| 13641 | 82 | guysbuf[eKEESE2].attributes[15] = 120; | |
| 13642 | 82 | guysbuf[eKEESE3].attributes[15] = 120; | |
| 13643 | 82 | guysbuf[eKEESETRIB].attributes[15] = 120; | |
| 13644 | 82 | guysbuf[eKEESE1].attributes[16] = 16; | |
| 13645 | 82 | guysbuf[eKEESE2].attributes[16] = 16; | |
| 13646 | 82 | guysbuf[eKEESE3].attributes[16] = 16; | |
| 13647 | 82 | guysbuf[eKEESETRIB].attributes[16] = 16; | |
| 13648 | |||
| 13649 | 82 | guysbuf[ePEAHAT].attributes[15] = 80; | |
| 13650 | 82 | guysbuf[ePEAHAT].attributes[16] = 16; | |
| 13651 | |||
| 13652 | 82 | guysbuf[eGHINI2].attributes[15] = 120; | |
| 13653 | 82 | guysbuf[eGHINI2].attributes[16] = 10; | |
| 13654 | |||
| 13655 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 66 times.
|
82 | if (replay_version_check(20)) |
| 13656 | { | ||
| 13657 | 66 | guysbuf[eGHINI2].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13658 | 66 | guysbuf[eMOLDORM].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13659 | 66 | guysbuf[eKEESETRIB].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13660 | 66 | guysbuf[eKEESE3].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13661 | 66 | guysbuf[eKEESE2].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13662 | 66 | guysbuf[eKEESE1].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13663 | 66 | guysbuf[eTEK1].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13664 | 66 | guysbuf[eTEK2].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13665 | 66 | guysbuf[ePEAHAT].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13666 | 66 | guysbuf[eROCK].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13667 | 66 | guysbuf[eTRAP].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13668 | 66 | guysbuf[eWALLM].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13669 | 66 | guysbuf[ePOLSV].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13670 | 66 | guysbuf[eMANHAN].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13671 | 66 | guysbuf[eGLEEOK1].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13672 | 66 | guysbuf[eGLEEOK2].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13673 | 66 | guysbuf[eGLEEOK3].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13674 | 66 | guysbuf[eGLEEOK4].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13675 | 66 | guysbuf[eDIG1].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13676 | 66 | guysbuf[eDIG3].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13677 | 66 | guysbuf[eDIGPUP1].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13678 | 66 | guysbuf[eDIGPUP2].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13679 | 66 | guysbuf[eDIGPUP3].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13680 | 66 | guysbuf[eDIGPUP4].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13681 | 66 | guysbuf[eRAQUAM].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13682 | 66 | guysbuf[eITEMFAIRY].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13683 | 66 | guysbuf[eFIRE].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13684 | 66 | guysbuf[eMANHAN2].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13685 | 66 | guysbuf[eTRAP_H].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13686 | 66 | guysbuf[eTRAP_V].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13687 | 66 | guysbuf[eTRAP_LR].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13688 | 66 | guysbuf[eTRAP_UD].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13689 | 66 | guysbuf[ePATRA1].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13690 | 66 | guysbuf[ePATRA2].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13691 | 66 | guysbuf[ePATRABS].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13692 | 66 | guysbuf[eBAT].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13693 | 66 | guysbuf[eGLEEOK1F].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13694 | 66 | guysbuf[eGLEEOK2F].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13695 | 66 | guysbuf[eGLEEOK3F].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13696 | 66 | guysbuf[eGLEEOK4F].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13697 | 66 | guysbuf[eTRIGGER].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13698 | 66 | guysbuf[ePATRAL2].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13699 | 66 | guysbuf[ePATRAL3].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13700 | 66 | guysbuf[eGOHMA1].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13701 | 66 | guysbuf[eGOHMA2].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13702 | 66 | guysbuf[eGOHMA3].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13703 | 66 | guysbuf[eGOHMA4].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13704 | 66 | guysbuf[eMPOLSV].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13705 | 66 | guysbuf[eWPOLSV].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13706 | 66 | } | |
| 13707 | 82 | } | |
| 13708 | |||
| 13709 | |||
| 13710 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 332 times.
|
414 | if(guyversion<=2) |
| 13711 | { | ||
| 13712 | 82 | return readherosprites2(f, guyversion==2?0:-1, 0); | |
| 13713 | } | ||
| 13714 | |||
| 13715 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | if(guyversion > 3) |
| 13716 | { | ||
| 13717 | guydata tempguy; | ||
| 13718 | |||
| 13719 |
2/2✓ Branch 0 taken 169984 times.
✓ Branch 1 taken 332 times.
|
170316 | for(int32_t i=0; i<MAXGUYS; i++) |
| 13720 | { | ||
| 13721 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(guyversion < 23) // May 2012 : 512 max enemies |
| 13722 | { | ||
| 13723 | ✗ | if(i >= OLDBETAMAXGUYS) | |
| 13724 | { | ||
| 13725 | ✗ | memset(&guysbuf[i], 0, sizeof(guydata)); | |
| 13726 | ✗ | continue; | |
| 13727 | } | ||
| 13728 | ✗ | } | |
| 13729 | |||
| 13730 | 169984 | memset(&tempguy, 0, sizeof(guydata)); | |
| 13731 | |||
| 13732 | uint32_t flags1; | ||
| 13733 | uint32_t flags2; | ||
| 13734 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_igetl(&(flags1),f)) |
| 13735 | { | ||
| 13736 | ✗ | return qe_invalid; | |
| 13737 | } | ||
| 13738 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_igetl(&(flags2),f)) |
| 13739 | { | ||
| 13740 | ✗ | return qe_invalid; | |
| 13741 | } | ||
| 13742 | 169984 | tempguy.flags = guy_flags(flags1) | guy_flags(uint64_t(flags2)<<32ULL); | |
| 13743 | |||
| 13744 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 96768 times.
|
169984 | if ( guyversion >= 36 ) //expanded tiles |
| 13745 | { | ||
| 13746 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_igetl(&(tempguy.tile),f)) |
| 13747 | { | ||
| 13748 | ✗ | return qe_invalid; | |
| 13749 | } | ||
| 13750 | 73216 | } | |
| 13751 | else | ||
| 13752 | { | ||
| 13753 |
1/2✓ Branch 0 taken 96768 times.
✗ Branch 1 not taken.
|
96768 | if(!p_igetw(&(tempguy.tile),f)) |
| 13754 | { | ||
| 13755 | ✗ | return qe_invalid; | |
| 13756 | } | ||
| 13757 | } | ||
| 13758 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_getc(&(tempguy.width),f)) |
| 13759 | { | ||
| 13760 | ✗ | return qe_invalid; | |
| 13761 | } | ||
| 13762 | |||
| 13763 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_getc(&(tempguy.height),f)) |
| 13764 | { | ||
| 13765 | ✗ | return qe_invalid; | |
| 13766 | } | ||
| 13767 | |||
| 13768 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 96768 times.
|
169984 | if ( guyversion >= 36 ) //expanded tiles |
| 13769 | { | ||
| 13770 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_igetl(&(tempguy.s_tile),f)) |
| 13771 | { | ||
| 13772 | ✗ | return qe_invalid; | |
| 13773 | } | ||
| 13774 | 73216 | } | |
| 13775 | else | ||
| 13776 | { | ||
| 13777 |
1/2✓ Branch 0 taken 96768 times.
✗ Branch 1 not taken.
|
96768 | if(!p_igetw(&(tempguy.s_tile),f)) |
| 13778 | { | ||
| 13779 | ✗ | return qe_invalid; | |
| 13780 | } | ||
| 13781 | } | ||
| 13782 | |||
| 13783 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_getc(&(tempguy.s_width),f)) |
| 13784 | { | ||
| 13785 | ✗ | return qe_invalid; | |
| 13786 | } | ||
| 13787 | |||
| 13788 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_getc(&(tempguy.s_height),f)) |
| 13789 | { | ||
| 13790 | ✗ | return qe_invalid; | |
| 13791 | } | ||
| 13792 | |||
| 13793 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 96768 times.
|
169984 | if ( guyversion >= 36 ) //expanded tiles |
| 13794 | { | ||
| 13795 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_igetl(&(tempguy.e_tile),f)) |
| 13796 | { | ||
| 13797 | ✗ | return qe_invalid; | |
| 13798 | } | ||
| 13799 | 73216 | } | |
| 13800 | else | ||
| 13801 | { | ||
| 13802 |
1/2✓ Branch 0 taken 96768 times.
✗ Branch 1 not taken.
|
96768 | if(!p_igetw(&(tempguy.e_tile),f)) |
| 13803 | { | ||
| 13804 | ✗ | return qe_invalid; | |
| 13805 | } | ||
| 13806 | } | ||
| 13807 | |||
| 13808 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_getc(&(tempguy.e_width),f)) |
| 13809 | { | ||
| 13810 | ✗ | return qe_invalid; | |
| 13811 | } | ||
| 13812 | |||
| 13813 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_getc(&(tempguy.e_height),f)) |
| 13814 | { | ||
| 13815 | ✗ | return qe_invalid; | |
| 13816 | } | ||
| 13817 | |||
| 13818 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_igetw(&(tempguy.hp),f)) |
| 13819 | { | ||
| 13820 | ✗ | return qe_invalid; | |
| 13821 | } | ||
| 13822 | |||
| 13823 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_igetw(&(tempguy.family),f)) |
| 13824 | { | ||
| 13825 | ✗ | return qe_invalid; | |
| 13826 | } | ||
| 13827 | |||
| 13828 |
1/12✗ Branch 0 not taken.
✓ Branch 1 taken 169984 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
169984 | if(guyversion < 9 && (i==eDKNUT1 || i==eDKNUT2 || i==eDKNUT3 || i==eDKNUT4 || i==eDKNUT5)) // Whoops, forgot about Darknuts... |
| 13829 | { | ||
| 13830 | ✗ | if(get_qr(qr_NEWENEMYTILES)) | |
| 13831 | { | ||
| 13832 | ✗ | tempguy.s_tile=tempguy.e_tile+120; | |
| 13833 | ✗ | tempguy.s_width=tempguy.e_width; | |
| 13834 | ✗ | tempguy.s_height=tempguy.e_height; | |
| 13835 | ✗ | } | |
| 13836 | ✗ | else tempguy.s_tile=860; | |
| 13837 | ✗ | } | |
| 13838 | |||
| 13839 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_igetw(&(tempguy.cset),f)) |
| 13840 | { | ||
| 13841 | ✗ | return qe_invalid; | |
| 13842 | } | ||
| 13843 | |||
| 13844 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_igetw(&(tempguy.anim),f)) |
| 13845 | { | ||
| 13846 | ✗ | return qe_invalid; | |
| 13847 | } | ||
| 13848 | |||
| 13849 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_igetw(&(tempguy.e_anim),f)) |
| 13850 | { | ||
| 13851 | ✗ | return qe_invalid; | |
| 13852 | } | ||
| 13853 | |||
| 13854 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_igetw(&(tempguy.frate),f)) |
| 13855 | { | ||
| 13856 | ✗ | return qe_invalid; | |
| 13857 | } | ||
| 13858 | |||
| 13859 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_igetw(&(tempguy.e_frate),f)) |
| 13860 | { | ||
| 13861 | ✗ | return qe_invalid; | |
| 13862 | } | ||
| 13863 | |||
| 13864 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(guyversion < 13) // April 2009 |
| 13865 | { | ||
| 13866 | ✗ | if(get_bit(deprecated_rules, qr_SLOWENEMYANIM_DEP)) | |
| 13867 | { | ||
| 13868 | ✗ | tempguy.frate *= 2; | |
| 13869 | ✗ | tempguy.e_frate *= 2; | |
| 13870 | ✗ | } | |
| 13871 | ✗ | } | |
| 13872 | |||
| 13873 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(guyversion < 14) // May 1 2009 |
| 13874 | { | ||
| 13875 | ✗ | if(tempguy.anim==a2FRMSLOW) | |
| 13876 | { | ||
| 13877 | ✗ | tempguy.anim=a2FRM; | |
| 13878 | ✗ | tempguy.frate *= 2; | |
| 13879 | ✗ | } | |
| 13880 | |||
| 13881 | ✗ | if(tempguy.e_anim==a2FRMSLOW) | |
| 13882 | { | ||
| 13883 | ✗ | tempguy.e_anim=a2FRM; | |
| 13884 | ✗ | tempguy.e_frate *= 2; | |
| 13885 | ✗ | } | |
| 13886 | |||
| 13887 | ✗ | if(tempguy.anim==aFLIPSLOW) | |
| 13888 | { | ||
| 13889 | ✗ | tempguy.anim=aFLIP; | |
| 13890 | ✗ | tempguy.frate *= 2; | |
| 13891 | ✗ | } | |
| 13892 | |||
| 13893 | ✗ | if(tempguy.e_anim==aFLIPSLOW) | |
| 13894 | { | ||
| 13895 | ✗ | tempguy.e_anim=aFLIP; | |
| 13896 | ✗ | tempguy.e_frate *= 2; | |
| 13897 | ✗ | } | |
| 13898 | |||
| 13899 | ✗ | if(tempguy.anim == aNEWDWALK) tempguy.anim = a4FRM4DIR; | |
| 13900 | |||
| 13901 | ✗ | if(tempguy.e_anim == aNEWDWALK) tempguy.e_anim = a4FRM4DIR; | |
| 13902 | |||
| 13903 | ✗ | if(tempguy.anim == aNEWPOLV || tempguy.anim == a4FRM3TRAP) | |
| 13904 | { | ||
| 13905 | ✗ | tempguy.anim=a4FRM4DIR; | |
| 13906 | ✗ | tempguy.s_tile=(get_qr(qr_NEWENEMYTILES) ? tempguy.e_tile : tempguy.tile)+20; | |
| 13907 | ✗ | } | |
| 13908 | |||
| 13909 | ✗ | if(tempguy.e_anim == aNEWPOLV || tempguy.e_anim == a4FRM3TRAP) | |
| 13910 | { | ||
| 13911 | ✗ | tempguy.e_anim=a4FRM4DIR; | |
| 13912 | ✗ | tempguy.s_tile=(get_qr(qr_NEWENEMYTILES) ? tempguy.e_tile : tempguy.tile)+20; | |
| 13913 | ✗ | } | |
| 13914 | ✗ | } | |
| 13915 | |||
| 13916 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_igetw(&(tempguy.dp),f)) |
| 13917 | { | ||
| 13918 | ✗ | return qe_invalid; | |
| 13919 | } | ||
| 13920 | |||
| 13921 | //correction for guy fire | ||
| 13922 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(guyversion < 6) |
| 13923 | { | ||
| 13924 | ✗ | if(i == gFIRE) | |
| 13925 | ✗ | tempguy.dp = 2; | |
| 13926 | ✗ | } | |
| 13927 | |||
| 13928 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_igetw(&(tempguy.wdp),f)) |
| 13929 | { | ||
| 13930 | ✗ | return qe_invalid; | |
| 13931 | } | ||
| 13932 | |||
| 13933 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_igetw(&(tempguy.weapon),f)) |
| 13934 | { | ||
| 13935 | ✗ | return qe_invalid; | |
| 13936 | } | ||
| 13937 | |||
| 13938 | //correction for bosses using triple, "rising" fireballs | ||
| 13939 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(guyversion < 5) |
| 13940 | { | ||
| 13941 | ✗ | if(i == eLAQUAM || i == eRAQUAM || i == eGOHMA1 || i == eGOHMA2 || | |
| 13942 | ✗ | i == eGOHMA3 || i == eGOHMA4) | |
| 13943 | { | ||
| 13944 | ✗ | if(tempguy.weapon == ewFireball) | |
| 13945 | ✗ | tempguy.weapon = ewFireball2; | |
| 13946 | ✗ | } | |
| 13947 | ✗ | } | |
| 13948 | |||
| 13949 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_igetw(&(tempguy.rate),f)) |
| 13950 | { | ||
| 13951 | ✗ | return qe_invalid; | |
| 13952 | } | ||
| 13953 | |||
| 13954 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_igetw(&(tempguy.hrate),f)) |
| 13955 | { | ||
| 13956 | ✗ | return qe_invalid; | |
| 13957 | } | ||
| 13958 | |||
| 13959 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_igetw(&(tempguy.step),f)) |
| 13960 | { | ||
| 13961 | ✗ | return qe_invalid; | |
| 13962 | } | ||
| 13963 | |||
| 13964 | // HIGHLY UNORTHODOX UPDATING THING, part 2 | ||
| 13965 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 169984 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
169984 | if(fixpolsvoice && tempguy.family==eePOLSV) |
| 13966 | { | ||
| 13967 | ✗ | tempguy.step /= 2; | |
| 13968 | ✗ | } | |
| 13969 | |||
| 13970 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_igetw(&(tempguy.homing),f)) |
| 13971 | { | ||
| 13972 | ✗ | return qe_invalid; | |
| 13973 | } | ||
| 13974 | |||
| 13975 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_igetw(&(tempguy.grumble),f)) |
| 13976 | { | ||
| 13977 | ✗ | return qe_invalid; | |
| 13978 | } | ||
| 13979 | |||
| 13980 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_igetw(&(tempguy.item_set),f)) |
| 13981 | { | ||
| 13982 | ✗ | return qe_invalid; | |
| 13983 | } | ||
| 13984 | |||
| 13985 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(guyversion>=22) // Version 22: Expand misc attributes to 32 bits |
| 13986 | { | ||
| 13987 |
2/2✓ Branch 0 taken 1699840 times.
✓ Branch 1 taken 169984 times.
|
1869824 | for (int q = 0; q < 10; ++q) |
| 13988 | { | ||
| 13989 |
1/2✓ Branch 0 taken 1699840 times.
✗ Branch 1 not taken.
|
1699840 | if (!p_igetl(&(tempguy.attributes[q]), f)) |
| 13990 | { | ||
| 13991 | ✗ | return qe_invalid; | |
| 13992 | } | ||
| 13993 | 1699840 | } | |
| 13994 | 169984 | } | |
| 13995 | else | ||
| 13996 | { | ||
| 13997 | int16_t tempMisc; | ||
| 13998 | |||
| 13999 | ✗ | for(int q=0;q<10;q++) | |
| 14000 | { | ||
| 14001 | ✗ | if (!p_igetw(&tempMisc, f)) | |
| 14002 | { | ||
| 14003 | ✗ | return qe_invalid; | |
| 14004 | } | ||
| 14005 | ✗ | tempguy.attributes[q] = tempMisc; | |
| 14006 | ✗ | } | |
| 14007 | |||
| 14008 | ✗ | if(guyversion < 13) // April 2009 - a tiny Wizzrobe update | |
| 14009 | { | ||
| 14010 | ✗ | if(tempguy.family == eeWIZZ && !(tempguy.attributes[0])) | |
| 14011 | ✗ | tempguy.attributes[4] = 74; | |
| 14012 | ✗ | } | |
| 14013 | |||
| 14014 | } | ||
| 14015 | |||
| 14016 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_igetw(&(tempguy.bgsfx),f)) |
| 14017 | { | ||
| 14018 | ✗ | return qe_invalid; | |
| 14019 | } | ||
| 14020 | |||
| 14021 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_igetw(&(tempguy.bosspal),f)) |
| 14022 | { | ||
| 14023 | ✗ | return qe_invalid; | |
| 14024 | } | ||
| 14025 | |||
| 14026 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_igetw(&(tempguy.extend),f)) |
| 14027 | { | ||
| 14028 | ✗ | return qe_invalid; | |
| 14029 | } | ||
| 14030 | |||
| 14031 | //! Enemy Defences | ||
| 14032 | |||
| 14033 | //If a 2.50 quest, use only the 2.5 defences. | ||
| 14034 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 169984 times.
|
169984 | if(guyversion >= 16 ) // November 2009 - Super Enemy Editor |
| 14035 | { | ||
| 14036 |
2/2✓ Branch 0 taken 3229696 times.
✓ Branch 1 taken 169984 times.
|
3399680 | for(int32_t j=0; j<edefLAST; j++) |
| 14037 | { | ||
| 14038 |
1/2✓ Branch 0 taken 3229696 times.
✗ Branch 1 not taken.
|
3229696 | if(!p_getc(&(tempguy.defense[j]),f)) |
| 14039 | { | ||
| 14040 | ✗ | return qe_invalid; | |
| 14041 | } | ||
| 14042 | 3229696 | } | |
| 14043 | //then copy the generic script defence to all the new script defences | ||
| 14044 | |||
| 14045 | 169984 | } | |
| 14046 | |||
| 14047 | |||
| 14048 | |||
| 14049 | |||
| 14050 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 169984 times.
|
169984 | if(guyversion >= 18) |
| 14051 | { | ||
| 14052 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_getc(&(tempguy.hitsfx),f)) |
| 14053 | { | ||
| 14054 | ✗ | return qe_invalid; | |
| 14055 | } | ||
| 14056 | |||
| 14057 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_getc(&(tempguy.deadsfx),f)) |
| 14058 | { | ||
| 14059 | ✗ | return qe_invalid; | |
| 14060 | } | ||
| 14061 | 169984 | } | |
| 14062 | |||
| 14063 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(guyversion >= 22) |
| 14064 | { | ||
| 14065 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_igetl(&(tempguy.attributes[10]), f)) |
| 14066 | { | ||
| 14067 | ✗ | return qe_invalid; | |
| 14068 | } | ||
| 14069 | |||
| 14070 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(!p_igetl(&(tempguy.attributes[11]),f)) |
| 14071 | { | ||
| 14072 | ✗ | return qe_invalid; | |
| 14073 | } | ||
| 14074 | 169984 | } | |
| 14075 | ✗ | else if(guyversion >= 19) | |
| 14076 | { | ||
| 14077 | int16_t tempMisc; | ||
| 14078 | |||
| 14079 | ✗ | if(!p_igetw(&tempMisc,f)) | |
| 14080 | { | ||
| 14081 | ✗ | return qe_invalid; | |
| 14082 | } | ||
| 14083 | |||
| 14084 | ✗ | tempguy.attributes[10] = tempMisc; | |
| 14085 | |||
| 14086 | ✗ | if(!p_igetw(&tempMisc,f)) | |
| 14087 | { | ||
| 14088 | ✗ | return qe_invalid; | |
| 14089 | } | ||
| 14090 | |||
| 14091 | ✗ | tempguy.attributes[11] = tempMisc; | |
| 14092 | ✗ | } | |
| 14093 | |||
| 14094 | //If a 2.54 or later quest, use all of the defences. | ||
| 14095 |
2/2✓ Branch 0 taken 96768 times.
✓ Branch 1 taken 73216 times.
|
169984 | if(guyversion > 24) // Add new guyversion conditional statement |
| 14096 | { | ||
| 14097 |
2/2✓ Branch 0 taken 1610752 times.
✓ Branch 1 taken 73216 times.
|
1683968 | for(int32_t j=edefLAST; j<edefLAST255; j++) |
| 14098 | { | ||
| 14099 |
1/2✓ Branch 0 taken 1610752 times.
✗ Branch 1 not taken.
|
1610752 | if(!p_getc(&(tempguy.defense[j]),f)) |
| 14100 | { | ||
| 14101 | ✗ | return qe_invalid; | |
| 14102 | } | ||
| 14103 | 1610752 | } | |
| 14104 | 73216 | } | |
| 14105 | |||
| 14106 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 96768 times.
|
169984 | if(guyversion <= 24) // Port over generic script settings from old quests in the new editor. |
| 14107 | { | ||
| 14108 |
2/2✓ Branch 0 taken 967680 times.
✓ Branch 1 taken 96768 times.
|
1064448 | for(int32_t j=edefSCRIPT01; j<=edefSCRIPT10; j++) |
| 14109 | { | ||
| 14110 | 967680 | tempguy.defense[j] = tempguy.defense[edefSCRIPT] ; | |
| 14111 | 967680 | } | |
| 14112 | 96768 | } | |
| 14113 | |||
| 14114 | //tilewidth, tileheight, hitwidth, hitheight, hitzheight, hitxofs, hityofs, hitzofs | ||
| 14115 |
2/2✓ Branch 0 taken 96768 times.
✓ Branch 1 taken 73216 times.
|
169984 | if(guyversion > 25) |
| 14116 | { | ||
| 14117 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_igetl(&(tempguy.txsz),f)) |
| 14118 | { | ||
| 14119 | ✗ | return qe_invalid; | |
| 14120 | } | ||
| 14121 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_igetl(&(tempguy.tysz),f)) |
| 14122 | { | ||
| 14123 | ✗ | return qe_invalid; | |
| 14124 | } | ||
| 14125 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_igetl(&(tempguy.hxsz),f)) |
| 14126 | { | ||
| 14127 | ✗ | return qe_invalid; | |
| 14128 | } | ||
| 14129 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_igetl(&(tempguy.hysz),f)) |
| 14130 | { | ||
| 14131 | ✗ | return qe_invalid; | |
| 14132 | } | ||
| 14133 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_igetl(&(tempguy.hzsz),f)) |
| 14134 | { | ||
| 14135 | ✗ | return qe_invalid; | |
| 14136 | } | ||
| 14137 | /* Is it safe to read a fixed with getl, or do I need to typecast it? -Z | ||
| 14138 | |||
| 14139 | */ | ||
| 14140 | 73216 | } | |
| 14141 | //More Enemy Editor vars for 2.60 | ||
| 14142 |
2/2✓ Branch 0 taken 96768 times.
✓ Branch 1 taken 73216 times.
|
169984 | if(guyversion > 26) |
| 14143 | { | ||
| 14144 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_igetl(&(tempguy.hxofs),f)) |
| 14145 | { | ||
| 14146 | ✗ | return qe_invalid; | |
| 14147 | } | ||
| 14148 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_igetl(&(tempguy.hyofs),f)) |
| 14149 | { | ||
| 14150 | ✗ | return qe_invalid; | |
| 14151 | } | ||
| 14152 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_igetl(&(tempguy.xofs),f)) |
| 14153 | { | ||
| 14154 | ✗ | return qe_invalid; | |
| 14155 | } | ||
| 14156 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_igetl(&(tempguy.yofs),f)) |
| 14157 | { | ||
| 14158 | ✗ | return qe_invalid; | |
| 14159 | } | ||
| 14160 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_igetl(&(tempguy.zofs),f)) |
| 14161 | { | ||
| 14162 | ✗ | return qe_invalid; | |
| 14163 | } | ||
| 14164 | 73216 | } | |
| 14165 | |||
| 14166 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 96768 times.
|
169984 | if(guyversion <= 27) // Port over generic script settings from old quests in the new editor. |
| 14167 | { | ||
| 14168 | 96768 | tempguy.wpnsprite = 0; | |
| 14169 | 96768 | } | |
| 14170 | |||
| 14171 |
2/2✓ Branch 0 taken 96768 times.
✓ Branch 1 taken 73216 times.
|
169984 | if(guyversion > 27) |
| 14172 | { | ||
| 14173 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_igetl(&(tempguy.wpnsprite),f)) |
| 14174 | { | ||
| 14175 | ✗ | return qe_invalid; | |
| 14176 | } | ||
| 14177 | 73216 | } | |
| 14178 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 96768 times.
|
169984 | if(guyversion <= 28) // Port over generic script settings from old quests in the new editor. |
| 14179 | { | ||
| 14180 | 96768 | tempguy.SIZEflags = 0; | |
| 14181 | 96768 | } | |
| 14182 |
2/2✓ Branch 0 taken 96768 times.
✓ Branch 1 taken 73216 times.
|
169984 | if(guyversion > 28) |
| 14183 | { | ||
| 14184 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_igetl(&(tempguy.SIZEflags),f)) |
| 14185 | { | ||
| 14186 | ✗ | return qe_invalid; | |
| 14187 | } | ||
| 14188 | |||
| 14189 | 73216 | } | |
| 14190 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 96768 times.
|
169984 | if(guyversion < 30) // Port over generic script settings from old quests in the new editor. |
| 14191 | { | ||
| 14192 | 96768 | tempguy.frozentile = 0; | |
| 14193 | 96768 | tempguy.frozencset = 0; | |
| 14194 | 96768 | tempguy.frozenclock = 0; | |
| 14195 |
2/2✓ Branch 0 taken 967680 times.
✓ Branch 1 taken 96768 times.
|
1064448 | for ( int32_t q = 0; q < 10; q++ ) tempguy.frozenmisc[q] = 0; |
| 14196 | 96768 | } | |
| 14197 |
2/2✓ Branch 0 taken 96768 times.
✓ Branch 1 taken 73216 times.
|
169984 | if(guyversion >= 30) |
| 14198 | { | ||
| 14199 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_igetl(&(tempguy.frozentile),f)) |
| 14200 | { | ||
| 14201 | ✗ | return qe_invalid; | |
| 14202 | } | ||
| 14203 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_igetl(&(tempguy.frozencset),f)) |
| 14204 | { | ||
| 14205 | ✗ | return qe_invalid; | |
| 14206 | } | ||
| 14207 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_igetl(&(tempguy.frozenclock),f)) |
| 14208 | { | ||
| 14209 | ✗ | return qe_invalid; | |
| 14210 | } | ||
| 14211 |
2/2✓ Branch 0 taken 732160 times.
✓ Branch 1 taken 73216 times.
|
805376 | for ( int32_t q = 0; q < 10; q++ ) { |
| 14212 |
1/2✓ Branch 0 taken 732160 times.
✗ Branch 1 not taken.
|
732160 | if(!p_igetw(&(tempguy.frozenmisc[q]),f)) |
| 14213 | { | ||
| 14214 | ✗ | return qe_invalid; | |
| 14215 | } | ||
| 14216 | 732160 | } | |
| 14217 | |||
| 14218 | 73216 | } | |
| 14219 | |||
| 14220 |
2/2✓ Branch 0 taken 96768 times.
✓ Branch 1 taken 73216 times.
|
169984 | if(guyversion >= 34) |
| 14221 | { | ||
| 14222 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_igetw(&(tempguy.firesfx),f)) |
| 14223 | { | ||
| 14224 | ✗ | return qe_invalid; | |
| 14225 | } | ||
| 14226 |
2/2✓ Branch 0 taken 1244672 times.
✓ Branch 1 taken 73216 times.
|
1317888 | for(int q=15;q<32;++q) |
| 14227 | { | ||
| 14228 |
1/2✓ Branch 0 taken 1244672 times.
✗ Branch 1 not taken.
|
1244672 | if(!p_igetl(&(tempguy.attributes[q]),f)) |
| 14229 | { | ||
| 14230 | ✗ | return qe_invalid; | |
| 14231 | } | ||
| 14232 | 1244672 | } | |
| 14233 | |||
| 14234 |
2/2✓ Branch 0 taken 2342912 times.
✓ Branch 1 taken 73216 times.
|
2416128 | for ( int32_t q = 0; q < 32; q++ ) { |
| 14235 |
1/2✓ Branch 0 taken 2342912 times.
✗ Branch 1 not taken.
|
2342912 | if(!p_igetl(&(tempguy.movement[q]),f)) |
| 14236 | { | ||
| 14237 | ✗ | return qe_invalid; | |
| 14238 | } | ||
| 14239 | 2342912 | } | |
| 14240 |
2/2✓ Branch 0 taken 2342912 times.
✓ Branch 1 taken 73216 times.
|
2416128 | for ( int32_t q = 0; q < 32; q++ ) { |
| 14241 |
1/2✓ Branch 0 taken 2342912 times.
✗ Branch 1 not taken.
|
2342912 | if(!p_igetl(&(tempguy.new_weapon[q]),f)) |
| 14242 | { | ||
| 14243 | ✗ | return qe_invalid; | |
| 14244 | } | ||
| 14245 | 2342912 | } | |
| 14246 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_igetw(&(tempguy.script),f)) |
| 14247 | { | ||
| 14248 | ✗ | return qe_invalid; | |
| 14249 | } | ||
| 14250 |
2/2✓ Branch 0 taken 585728 times.
✓ Branch 1 taken 73216 times.
|
658944 | for ( int32_t q = 0; q < 8; q++ ) |
| 14251 | { | ||
| 14252 |
1/2✓ Branch 0 taken 585728 times.
✗ Branch 1 not taken.
|
585728 | if(!p_igetl(&(tempguy.initD[q]),f)) |
| 14253 | { | ||
| 14254 | ✗ | return qe_invalid; | |
| 14255 | } | ||
| 14256 | 585728 | } | |
| 14257 |
2/2✓ Branch 0 taken 146432 times.
✓ Branch 1 taken 73216 times.
|
219648 | for ( int32_t q = 0; q < 2; q++ ) |
| 14258 | { | ||
| 14259 |
1/2✓ Branch 0 taken 146432 times.
✗ Branch 1 not taken.
|
146432 | if(!p_igetl(&(tempguy.initA[q]),f)) |
| 14260 | { | ||
| 14261 | ✗ | return qe_invalid; | |
| 14262 | } | ||
| 14263 | 146432 | } | |
| 14264 | |||
| 14265 | 73216 | } | |
| 14266 | |||
| 14267 |
2/2✓ Branch 0 taken 96768 times.
✓ Branch 1 taken 73216 times.
|
169984 | if(guyversion >= 37) |
| 14268 | { | ||
| 14269 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_igetl(&(tempguy.editorflags),f)) |
| 14270 | { | ||
| 14271 | ✗ | return qe_invalid; | |
| 14272 | } | ||
| 14273 | 73216 | } | |
| 14274 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 96768 times.
|
169984 | if ( guyversion < 37 ) { tempguy.editorflags = 0; } |
| 14275 |
2/2✓ Branch 0 taken 96768 times.
✓ Branch 1 taken 73216 times.
|
169984 | if(guyversion >= 38) |
| 14276 | { | ||
| 14277 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_igetl(&(tempguy.attributes[12]),f)) |
| 14278 | { | ||
| 14279 | ✗ | return qe_invalid; | |
| 14280 | } | ||
| 14281 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_igetl(&(tempguy.attributes[13]),f)) |
| 14282 | { | ||
| 14283 | ✗ | return qe_invalid; | |
| 14284 | } | ||
| 14285 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_igetl(&(tempguy.attributes[14]),f)) |
| 14286 | { | ||
| 14287 | ✗ | return qe_invalid; | |
| 14288 | } | ||
| 14289 | |||
| 14290 | 73216 | } | |
| 14291 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 96768 times.
|
169984 | if ( guyversion < 38 ) |
| 14292 | { | ||
| 14293 | 96768 | tempguy.attributes[12] = 0; | |
| 14294 | 96768 | tempguy.attributes[13] = 0; | |
| 14295 | 96768 | tempguy.attributes[14] = 0; | |
| 14296 | 96768 | } | |
| 14297 | |||
| 14298 |
2/2✓ Branch 0 taken 96768 times.
✓ Branch 1 taken 73216 times.
|
169984 | if ( guyversion >= 39 ) |
| 14299 | { | ||
| 14300 |
2/2✓ Branch 0 taken 585728 times.
✓ Branch 1 taken 73216 times.
|
658944 | for ( int32_t q = 0; q < 8; q++ ) |
| 14301 | { | ||
| 14302 |
2/2✓ Branch 0 taken 38072320 times.
✓ Branch 1 taken 585728 times.
|
38658048 | for ( int32_t w = 0; w < 65; w++ ) |
| 14303 | { | ||
| 14304 |
1/2✓ Branch 0 taken 38072320 times.
✗ Branch 1 not taken.
|
38072320 | if(!p_getc(&(tempguy.initD_label[q][w]),f)) |
| 14305 | { | ||
| 14306 | ✗ | return qe_invalid; | |
| 14307 | } | ||
| 14308 | 38072320 | } | |
| 14309 |
2/2✓ Branch 0 taken 38072320 times.
✓ Branch 1 taken 585728 times.
|
38658048 | for ( int32_t w = 0; w < 65; w++ ) |
| 14310 | { | ||
| 14311 |
1/2✓ Branch 0 taken 38072320 times.
✗ Branch 1 not taken.
|
38072320 | if(!p_getc(&(tempguy.weapon_initD_label[q][w]),f)) |
| 14312 | { | ||
| 14313 | ✗ | return qe_invalid; | |
| 14314 | } | ||
| 14315 | 38072320 | } | |
| 14316 | 585728 | } | |
| 14317 | |||
| 14318 | |||
| 14319 | 73216 | } | |
| 14320 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 96768 times.
|
169984 | if ( guyversion < 39 ) //apply old InitD strings to both |
| 14321 | { | ||
| 14322 |
2/2✓ Branch 0 taken 774144 times.
✓ Branch 1 taken 96768 times.
|
870912 | for ( int32_t q = 0; q < 8; q++ ) |
| 14323 | { | ||
| 14324 | 774144 | sprintf(tempguy.initD_label[q],"InitD[%d]",q); | |
| 14325 | 774144 | sprintf(tempguy.weapon_initD_label[q],"InitD[%d]",q); | |
| 14326 | 774144 | } | |
| 14327 | 96768 | } | |
| 14328 |
2/2✓ Branch 0 taken 96768 times.
✓ Branch 1 taken 73216 times.
|
169984 | if ( guyversion >= 40 ) |
| 14329 | { | ||
| 14330 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_igetw(&(tempguy.weaponscript),f)) |
| 14331 | { | ||
| 14332 | ✗ | return qe_invalid; | |
| 14333 | } | ||
| 14334 | 73216 | } | |
| 14335 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 96768 times.
|
169984 | if ( guyversion < 40 ) |
| 14336 | { | ||
| 14337 | 96768 | tempguy.weaponscript = 0; | |
| 14338 | 96768 | } | |
| 14339 | //eweapon script InitD | ||
| 14340 |
2/2✓ Branch 0 taken 96768 times.
✓ Branch 1 taken 73216 times.
|
169984 | if ( guyversion >= 41 ) |
| 14341 | { | ||
| 14342 |
2/2✓ Branch 0 taken 585728 times.
✓ Branch 1 taken 73216 times.
|
658944 | for ( int32_t q = 0; q < 8; q++ ) |
| 14343 | { | ||
| 14344 |
1/2✓ Branch 0 taken 585728 times.
✗ Branch 1 not taken.
|
585728 | if(!p_igetl(&(tempguy.weap_initiald[q]),f)) |
| 14345 | { | ||
| 14346 | ✗ | return qe_invalid; | |
| 14347 | } | ||
| 14348 | 585728 | } | |
| 14349 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if ( guy_cversion < 4 ) |
| 14350 | { | ||
| 14351 | ✗ | if ( tempguy.family == eeKEESE ) | |
| 14352 | { | ||
| 14353 | |||
| 14354 | ✗ | if ( !tempguy.attributes[0] ) | |
| 14355 | { | ||
| 14356 | ✗ | tempguy.attributes[15] = 120; | |
| 14357 | ✗ | tempguy.attributes[16] = 16; | |
| 14358 | |||
| 14359 | ✗ | } | |
| 14360 | ✗ | } | |
| 14361 | ✗ | if ( tempguy.family == eePEAHAT ) | |
| 14362 | { | ||
| 14363 | ✗ | tempguy.attributes[15] = 80; | |
| 14364 | ✗ | tempguy.attributes[16] = 16; | |
| 14365 | ✗ | } | |
| 14366 | |||
| 14367 | ✗ | if ( tempguy.family == eeGHINI ) | |
| 14368 | { | ||
| 14369 | ✗ | tempguy.attributes[15] = 120; | |
| 14370 | ✗ | tempguy.attributes[16] = 10; | |
| 14371 | ✗ | } | |
| 14372 | |||
| 14373 | ✗ | } | |
| 14374 | 73216 | } | |
| 14375 | |||
| 14376 | |||
| 14377 | |||
| 14378 | //default weapon sprites (quest version < 2.54) | ||
| 14379 | //port over old defaults -Z | ||
| 14380 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 96768 times.
|
169984 | if(guyversion < 32) |
| 14381 | { | ||
| 14382 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 96768 times.
|
96768 | if ( tempguy.wpnsprite <= 0 ) |
| 14383 | { | ||
| 14384 |
16/20✗ Branch 0 not taken.
✓ Branch 1 taken 2720 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 81949 times.
✓ Branch 4 taken 762 times.
✓ Branch 5 taken 659 times.
✓ Branch 6 taken 1824 times.
✓ Branch 7 taken 1227 times.
✓ Branch 8 taken 2290 times.
✓ Branch 9 taken 195 times.
✓ Branch 10 taken 77 times.
✓ Branch 11 taken 423 times.
✓ Branch 12 taken 77 times.
✓ Branch 13 taken 865 times.
✓ Branch 14 taken 1715 times.
✓ Branch 15 taken 219 times.
✓ Branch 16 taken 311 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 1455 times.
|
96768 | switch(tempguy.weapon) |
| 14385 | { | ||
| 14386 | case wNone: | ||
| 14387 | 81949 | tempguy.wpnsprite = 0; break; | |
| 14388 | |||
| 14389 | case wSword: | ||
| 14390 | case wBeam: | ||
| 14391 | case wBrang: | ||
| 14392 | case wBomb: | ||
| 14393 | case wSBomb: | ||
| 14394 | case wLitBomb: | ||
| 14395 | case wLitSBomb: | ||
| 14396 | case wArrow: | ||
| 14397 | case wFire: | ||
| 14398 | case wWhistle: | ||
| 14399 | case wBait: | ||
| 14400 | case wWand: | ||
| 14401 | case wMagic: | ||
| 14402 | case wCatching: | ||
| 14403 | case wWind: | ||
| 14404 | case wRefMagic: | ||
| 14405 | case wRefFireball: | ||
| 14406 | case wRefRock: | ||
| 14407 | case wHammer: | ||
| 14408 | case wHookshot: | ||
| 14409 | case wHSHandle: | ||
| 14410 | case wHSChain: | ||
| 14411 | case wSSparkle: | ||
| 14412 | case wFSparkle: | ||
| 14413 | case wSmack: | ||
| 14414 | case wPhantom: | ||
| 14415 | case wCByrna: | ||
| 14416 | case wRefBeam: | ||
| 14417 | case wStomp: | ||
| 14418 | case lwMax: | ||
| 14419 | case wScript1: | ||
| 14420 | case wScript2: | ||
| 14421 | case wScript3: | ||
| 14422 | case wScript4: | ||
| 14423 | case wScript5: | ||
| 14424 | case wScript6: | ||
| 14425 | case wScript7: | ||
| 14426 | case wScript8: | ||
| 14427 | case wScript9: | ||
| 14428 | case wScript10: | ||
| 14429 | case wIce: | ||
| 14430 | //Cannot use any of these weapons yet. | ||
| 14431 | ✗ | tempguy.wpnsprite = -1; | |
| 14432 | ✗ | break; | |
| 14433 | |||
| 14434 | case wEnemyWeapons: | ||
| 14435 | 2720 | case ewFireball: tempguy.wpnsprite = 17; break; | |
| 14436 | |||
| 14437 | 762 | case ewArrow: tempguy.wpnsprite = 19; break; | |
| 14438 | 659 | case ewBrang: tempguy.wpnsprite = 4; break; | |
| 14439 | 1824 | case ewSword: tempguy.wpnsprite = 20; break; | |
| 14440 | 1227 | case ewRock: tempguy.wpnsprite = 18; break; | |
| 14441 | 2290 | case ewMagic: tempguy.wpnsprite = 21; break; | |
| 14442 | 195 | case ewBomb: tempguy.wpnsprite = 78; break; | |
| 14443 | 77 | case ewSBomb: tempguy.wpnsprite = 79; break; | |
| 14444 | 423 | case ewLitBomb: tempguy.wpnsprite = 76; break; | |
| 14445 | 77 | case ewLitSBomb: tempguy.wpnsprite = 77; break; | |
| 14446 | 865 | case ewFireTrail: tempguy.wpnsprite = 80; break; | |
| 14447 | 1715 | case ewFlame: tempguy.wpnsprite = 35; break; | |
| 14448 | 219 | case ewWind: tempguy.wpnsprite = 36; break; | |
| 14449 | 311 | case ewFlame2: tempguy.wpnsprite = 81; break; | |
| 14450 | ✗ | case ewFlame2Trail: tempguy.wpnsprite = 82; break; | |
| 14451 | ✗ | case ewIce: tempguy.wpnsprite = 83; break; | |
| 14452 | 1455 | case ewFireball2: tempguy.wpnsprite = 17; break; //fireball (rising) | |
| 14453 | |||
| 14454 | |||
| 14455 | ✗ | default: break; //No assign. | |
| 14456 | } | ||
| 14457 | 96768 | } | |
| 14458 | 96768 | } | |
| 14459 | |||
| 14460 | //default weapon fire sound (quest version < 2.54) | ||
| 14461 | //port over old defaults and zero new data. -Z | ||
| 14462 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 96768 times.
|
169984 | if(guyversion < 34) |
| 14463 | { | ||
| 14464 |
2/2✓ Branch 0 taken 3096576 times.
✓ Branch 1 taken 96768 times.
|
3193344 | for ( int32_t q = 0; q < 32; q++ ) |
| 14465 | { | ||
| 14466 | 3096576 | tempguy.movement[q] = 0; | |
| 14467 | 3096576 | tempguy.new_weapon[q] = 0; | |
| 14468 | |||
| 14469 | 3096576 | } | |
| 14470 | |||
| 14471 | //NPC Script attributes. | ||
| 14472 | 96768 | tempguy.script = 0; //No scripted enemies existed. -Z | |
| 14473 |
2/2✓ Branch 0 taken 774144 times.
✓ Branch 1 taken 96768 times.
|
870912 | for ( int32_t q = 0; q < 8; q++ ) tempguy.initD[q] = 0; //Script Data |
| 14474 |
2/2✓ Branch 0 taken 193536 times.
✓ Branch 1 taken 96768 times.
|
290304 | for ( int32_t q = 0; q < 2; q++ ) tempguy.initA[q] = 0; //Script Data |
| 14475 | |||
| 14476 |
2/2✓ Branch 0 taken 1645056 times.
✓ Branch 1 taken 96768 times.
|
1741824 | for ( int32_t q = 15; q < 32; q++) tempguy.attributes[q] = 0; //misc 16-32 |
| 14477 | |||
| 14478 | //old default sounds | ||
| 14479 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 96768 times.
|
96768 | if ( tempguy.firesfx <= 0 ) |
| 14480 | { | ||
| 14481 |
16/20✗ Branch 0 not taken.
✓ Branch 1 taken 2720 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 81949 times.
✓ Branch 4 taken 762 times.
✓ Branch 5 taken 659 times.
✓ Branch 6 taken 1824 times.
✓ Branch 7 taken 1227 times.
✓ Branch 8 taken 2290 times.
✓ Branch 9 taken 195 times.
✓ Branch 10 taken 77 times.
✓ Branch 11 taken 423 times.
✓ Branch 12 taken 77 times.
✓ Branch 13 taken 865 times.
✓ Branch 14 taken 1715 times.
✓ Branch 15 taken 219 times.
✓ Branch 16 taken 311 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 1455 times.
|
96768 | switch(tempguy.weapon) |
| 14482 | { | ||
| 14483 | case wNone: | ||
| 14484 | 81949 | tempguy.firesfx = 0; break; | |
| 14485 | |||
| 14486 | case wSword: | ||
| 14487 | case wBeam: | ||
| 14488 | case wBrang: | ||
| 14489 | case wBomb: | ||
| 14490 | case wSBomb: | ||
| 14491 | case wLitBomb: | ||
| 14492 | case wLitSBomb: | ||
| 14493 | case wArrow: | ||
| 14494 | case wFire: | ||
| 14495 | case wWhistle: | ||
| 14496 | case wBait: | ||
| 14497 | case wWand: | ||
| 14498 | case wMagic: | ||
| 14499 | case wCatching: | ||
| 14500 | case wWind: | ||
| 14501 | case wRefMagic: | ||
| 14502 | case wRefFireball: | ||
| 14503 | case wRefRock: | ||
| 14504 | case wHammer: | ||
| 14505 | case wHookshot: | ||
| 14506 | case wHSHandle: | ||
| 14507 | case wHSChain: | ||
| 14508 | case wSSparkle: | ||
| 14509 | case wFSparkle: | ||
| 14510 | case wSmack: | ||
| 14511 | case wPhantom: | ||
| 14512 | case wCByrna: | ||
| 14513 | case wRefBeam: | ||
| 14514 | case wStomp: | ||
| 14515 | case lwMax: | ||
| 14516 | case wScript1: | ||
| 14517 | case wScript2: | ||
| 14518 | case wScript3: | ||
| 14519 | case wScript4: | ||
| 14520 | case wScript5: | ||
| 14521 | case wScript6: | ||
| 14522 | case wScript7: | ||
| 14523 | case wScript8: | ||
| 14524 | case wScript9: | ||
| 14525 | case wScript10: | ||
| 14526 | case wIce: | ||
| 14527 | //Cannot use any of these weapons yet. | ||
| 14528 | ✗ | tempguy.firesfx = -1; | |
| 14529 | ✗ | break; | |
| 14530 | |||
| 14531 | case wEnemyWeapons: | ||
| 14532 | 2720 | case ewFireball: tempguy.firesfx = 40; break; | |
| 14533 | |||
| 14534 | 762 | case ewArrow: tempguy.firesfx = 1; break; //Ghost.zh has 0? | |
| 14535 | 659 | case ewBrang: tempguy.firesfx = 4; break; //Ghost.zh has 0? | |
| 14536 | 1824 | case ewSword: tempguy.firesfx = 20; break; //Ghost.zh has 0? | |
| 14537 | 1227 | case ewRock: tempguy.firesfx = 51; break; | |
| 14538 | 2290 | case ewMagic: tempguy.firesfx = 32; break; | |
| 14539 | 195 | case ewBomb: tempguy.firesfx = 3; break; //Ghost.zh has 0? | |
| 14540 | 77 | case ewSBomb: tempguy.firesfx = 3; break; //Ghost.zh has 0? | |
| 14541 | 423 | case ewLitBomb: tempguy.firesfx = 21; break; //Ghost.zh has 0? | |
| 14542 | 77 | case ewLitSBomb: tempguy.firesfx = 21; break; //Ghost.zh has 0? | |
| 14543 | 865 | case ewFireTrail: tempguy.firesfx = 13; break; | |
| 14544 | 1715 | case ewFlame: tempguy.firesfx = 13; break; | |
| 14545 | 219 | case ewWind: tempguy.firesfx = 32; break; | |
| 14546 | 311 | case ewFlame2: tempguy.firesfx = 13; break; | |
| 14547 | ✗ | case ewFlame2Trail: tempguy.firesfx = 13; break; | |
| 14548 | ✗ | case ewIce: tempguy.firesfx = 44; break; | |
| 14549 | 1455 | case ewFireball2: tempguy.firesfx = 40; break; //fireball (rising) | |
| 14550 | |||
| 14551 | //what about special attacks (e.g. summoning == 56) | ||
| 14552 | ✗ | default: break; //No assign. | |
| 14553 | } | ||
| 14554 | 96768 | } | |
| 14555 | 96768 | } | |
| 14556 | |||
| 14557 | //Port hardcoded hit sound to the enemy hitsfx defaults for older quests. | ||
| 14558 |
4/6✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 96768 times.
✓ Branch 2 taken 73216 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 73216 times.
|
169984 | if(Header->zelda_version <= 0x250 || ( Header->zelda_version > 0x250 && guyversion < 35 )) |
| 14559 | { | ||
| 14560 |
2/2✓ Branch 0 taken 13335 times.
✓ Branch 1 taken 83433 times.
|
96768 | if ( tempguy.hitsfx == 0 ) tempguy.hitsfx = 11; |
| 14561 | 96768 | } | |
| 14562 | //Keese and bat halt rates. | ||
| 14563 |
3/4✓ Branch 0 taken 96768 times.
✓ Branch 1 taken 73216 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 96768 times.
|
169984 | if ( guyversion < 42 && guy_cversion < 4 ) |
| 14564 | { | ||
| 14565 | |||
| 14566 |
2/2✓ Branch 0 taken 95530 times.
✓ Branch 1 taken 1238 times.
|
96768 | if ( tempguy.family == eeKEESE ) |
| 14567 | { | ||
| 14568 | |||
| 14569 |
2/2✓ Branch 0 taken 349 times.
✓ Branch 1 taken 889 times.
|
1238 | if ( !tempguy.attributes[0] ) |
| 14570 | { | ||
| 14571 | 889 | tempguy.attributes[15] = 120; | |
| 14572 | 889 | tempguy.attributes[16] = 16; | |
| 14573 | |||
| 14574 | 889 | } | |
| 14575 | 1238 | } | |
| 14576 |
2/2✓ Branch 0 taken 96325 times.
✓ Branch 1 taken 443 times.
|
96768 | if ( tempguy.family == eePEAHAT ) |
| 14577 | { | ||
| 14578 | 443 | tempguy.attributes[15] = 80; | |
| 14579 | 443 | tempguy.attributes[16] = 16; | |
| 14580 | 443 | } | |
| 14581 |
2/2✓ Branch 0 taken 96579 times.
✓ Branch 1 taken 189 times.
|
96768 | if ( tempguy.family == eeGHINI ) |
| 14582 | { | ||
| 14583 | 189 | tempguy.attributes[15] = 120; | |
| 14584 | 189 | tempguy.attributes[16] = 10; | |
| 14585 | 189 | } | |
| 14586 | |||
| 14587 | |||
| 14588 | 96768 | } | |
| 14589 | |||
| 14590 | |||
| 14591 | //miscellaneous other corrections | ||
| 14592 | //fix the mirror wizzrobe -DD | ||
| 14593 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(guyversion < 7) |
| 14594 | { | ||
| 14595 | ✗ | if(i == eMWIZ) | |
| 14596 | { | ||
| 14597 | ✗ | tempguy.attributes[1] = 0; | |
| 14598 | ✗ | tempguy.attributes[3] = 1; | |
| 14599 | ✗ | } | |
| 14600 | ✗ | } | |
| 14601 | |||
| 14602 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(guyversion < 8) |
| 14603 | { | ||
| 14604 | ✗ | if(i == eGLEEOK1 || i == eGLEEOK2 || i == eGLEEOK3 || i == eGLEEOK4 || i == eGLEEOK1F || i == eGLEEOK2F || i == eGLEEOK3F || i == eGLEEOK4F) | |
| 14605 | { | ||
| 14606 | // Some of these are deliberately different to NewDefault/defdata.cpp, by the way. -L | ||
| 14607 | ✗ | tempguy.attributes[4] = 4; //neck length in segments | |
| 14608 | ✗ | tempguy.attributes[5] = 8; //neck offset from first body tile | |
| 14609 | ✗ | tempguy.attributes[6] = 40; //offset for each subsequent neck tile from the first neck tile | |
| 14610 | ✗ | tempguy.attributes[7] = 168; //head offset from first body tile | |
| 14611 | ✗ | tempguy.attributes[8] = 228; //flying head offset from first body tile | |
| 14612 | |||
| 14613 | ✗ | if(i == eGLEEOK1F || i == eGLEEOK2F || i == eGLEEOK3F || i == eGLEEOK4F) | |
| 14614 | { | ||
| 14615 | ✗ | tempguy.attributes[5] += 10; //neck offset from first body tile | |
| 14616 | ✗ | tempguy.attributes[7] -= 12; //head offset from first body tile | |
| 14617 | ✗ | } | |
| 14618 | ✗ | } | |
| 14619 | ✗ | } | |
| 14620 | |||
| 14621 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(guyversion < 10) // December 2007 - Dodongo CSet fix |
| 14622 | { | ||
| 14623 | ✗ | if(get_bit(deprecated_rules,46) && tempguy.family==eeDONGO && tempguy.attributes[0]==0) | |
| 14624 | ✗ | tempguy.bosspal = spDIG; | |
| 14625 | ✗ | } | |
| 14626 | |||
| 14627 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(guyversion < 11) // December 2007 - Spinning Tile fix |
| 14628 | { | ||
| 14629 | ✗ | if(tempguy.family==eeSPINTILE) | |
| 14630 | { | ||
| 14631 | ✗ | tempguy.flags |= guy_superman; | |
| 14632 | ✗ | tempguy.item_set = 0; // Don't drop items | |
| 14633 | ✗ | tempguy.step = 300; | |
| 14634 | ✗ | } | |
| 14635 | ✗ | } | |
| 14636 | |||
| 14637 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(guyversion < 12) // October 2008 - Flashing Bubble, Rope 2, and Ghini 2 fix |
| 14638 | { | ||
| 14639 | ✗ | if(get_bit(deprecated_rules, qr_NOROPE2FLASH_DEP)) | |
| 14640 | { | ||
| 14641 | ✗ | if(tempguy.family==eeROPE) | |
| 14642 | { | ||
| 14643 | ✗ | tempguy.flags &= ~guy_flashing; | |
| 14644 | ✗ | } | |
| 14645 | ✗ | } | |
| 14646 | |||
| 14647 | ✗ | if(get_bit(deprecated_rules, qr_NOBUBBLEFLASH_DEP)) | |
| 14648 | { | ||
| 14649 | ✗ | if(tempguy.family==eeBUBBLE) | |
| 14650 | { | ||
| 14651 | ✗ | tempguy.flags &= ~guy_flashing; | |
| 14652 | ✗ | } | |
| 14653 | ✗ | } | |
| 14654 | |||
| 14655 | ✗ | if((tempguy.family==eeGHINI)&&(tempguy.attributes[0])) | |
| 14656 | { | ||
| 14657 | ✗ | if(get_bit(deprecated_rules, qr_GHINI2BLINK_DEP)) | |
| 14658 | { | ||
| 14659 | ✗ | tempguy.flags |= guy_blinking; | |
| 14660 | ✗ | } | |
| 14661 | |||
| 14662 | ✗ | if(get_bit(deprecated_rules, qr_PHANTOMGHINI2_DEP)) | |
| 14663 | { | ||
| 14664 | ✗ | tempguy.flags |= guy_transparent; | |
| 14665 | ✗ | } | |
| 14666 | ✗ | } | |
| 14667 | ✗ | } | |
| 14668 | |||
| 14669 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(guyversion < 15) // July 2009 - Guy Fire and Fairy fix |
| 14670 | { | ||
| 14671 | ✗ | if(i==gFIRE) | |
| 14672 | { | ||
| 14673 | ✗ | tempguy.e_anim = aFLIP; | |
| 14674 | ✗ | tempguy.e_frate = 24; | |
| 14675 | ✗ | } | |
| 14676 | |||
| 14677 | ✗ | if(i==gFAIRY) | |
| 14678 | { | ||
| 14679 | ✗ | tempguy.e_anim = a2FRM; | |
| 14680 | ✗ | tempguy.e_frate = 16; | |
| 14681 | ✗ | } | |
| 14682 | ✗ | } | |
| 14683 | |||
| 14684 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(guyversion < 16) // November 2009 - Super Enemy Editor part 1 |
| 14685 | { | ||
| 14686 | ✗ | if(i==0) Z_message("Updating guys to version 16...\n"); | |
| 14687 | |||
| 14688 | ✗ | update_guy_1(&tempguy); | |
| 14689 | |||
| 14690 | ✗ | if(i==eMPOLSV) | |
| 14691 | { | ||
| 14692 | ✗ | tempguy.defense[edefARROW] = edCHINK; | |
| 14693 | ✗ | tempguy.defense[edefMAGIC] = ed1HKO; | |
| 14694 | ✗ | tempguy.defense[edefREFMAGIC] = ed1HKO; | |
| 14695 | ✗ | } | |
| 14696 | ✗ | } | |
| 14697 | |||
| 14698 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(guyversion < 17) // December 2009 |
| 14699 | { | ||
| 14700 | ✗ | if(tempguy.family==eePROJECTILE) | |
| 14701 | { | ||
| 14702 | ✗ | tempguy.attributes[0] = 0; | |
| 14703 | ✗ | } | |
| 14704 | ✗ | } | |
| 14705 | |||
| 14706 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(guyversion < 18) // January 2010 |
| 14707 | { | ||
| 14708 | ✗ | bool boss = (tempguy.family == eeAQUA || tempguy.family==eeDONGO || tempguy.family == eeMANHAN || tempguy.family == eeGHOMA || tempguy.family==eeDIG | |
| 14709 | ✗ | || tempguy.family == eeGLEEOK || tempguy.family==eePATRA || tempguy.family == eeGANON || tempguy.family==eeMOLD); | |
| 14710 | |||
| 14711 | ✗ | tempguy.hitsfx = (boss && tempguy.family != eeMOLD && tempguy.family != eeDONGO && tempguy.family != eeDIG) ? WAV_GASP : 0; | |
| 14712 | ✗ | tempguy.deadsfx = (boss && (tempguy.family != eeDIG || tempguy.attributes[9] == 0)) ? WAV_GASP : WAV_EDEAD; | |
| 14713 | |||
| 14714 | ✗ | if(tempguy.family == eeAQUA) | |
| 14715 | ✗ | for(int32_t j=0; j<edefLAST; j++) tempguy.defense[j] = default_guys[eRAQUAM].defense[j]; | |
| 14716 | ✗ | else if(tempguy.family == eeMANHAN) | |
| 14717 | ✗ | for(int32_t j=0; j<edefLAST; j++) tempguy.defense[j] = default_guys[eMANHAN].defense[j]; | |
| 14718 | ✗ | else if(tempguy.family==eePATRA) | |
| 14719 | ✗ | for(int32_t j=0; j<edefLAST; j++) tempguy.defense[j] = default_guys[eGLEEOK1].defense[j]; | |
| 14720 | ✗ | else if(tempguy.family==eeGHOMA) | |
| 14721 | { | ||
| 14722 | ✗ | for(int32_t j=0; j<edefLAST; j++) | |
| 14723 | ✗ | tempguy.defense[j] = default_guys[eGOHMA1].defense[j]; | |
| 14724 | |||
| 14725 | ✗ | tempguy.defense[edefARROW] = ((tempguy.attributes[0]==3) ? edCHINKL8 : (tempguy.attributes[0]==2) ? edCHINKL4 : 0); | |
| 14726 | |||
| 14727 | ✗ | if(tempguy.attributes[0]==3 && !tempguy.weapon) tempguy.weapon = ewFlame; | |
| 14728 | |||
| 14729 | ✗ | tempguy.attributes[0]--; | |
| 14730 | ✗ | } | |
| 14731 | ✗ | else if(tempguy.family == eeGLEEOK) | |
| 14732 | { | ||
| 14733 | ✗ | for(int32_t j=0; j<edefLAST; j++) | |
| 14734 | ✗ | tempguy.defense[j] = default_guys[eGLEEOK1].defense[j]; | |
| 14735 | |||
| 14736 | ✗ | if(tempguy.attributes[2]==1 && !tempguy.weapon) tempguy.weapon = ewFlame; | |
| 14737 | ✗ | } | |
| 14738 | ✗ | else if(tempguy.family == eeARMOS) | |
| 14739 | { | ||
| 14740 | ✗ | tempguy.family=eeWALK; | |
| 14741 | ✗ | tempguy.hrate = 0; | |
| 14742 | ✗ | tempguy.attributes[9] = tempguy.attributes[0]; | |
| 14743 | ✗ | tempguy.attributes[0] = tempguy.attributes[1] = tempguy.attributes[2] = tempguy.attributes[3] = tempguy.attributes[4] = tempguy.attributes[5] = tempguy.attributes[6] = tempguy.attributes[7] = 0; | |
| 14744 | ✗ | tempguy.attributes[0] = tempguy.attributes[1] = tempguy.attributes[2] = tempguy.attributes[3] = tempguy.attributes[4] = tempguy.attributes[5] = tempguy.attributes[6] = tempguy.attributes[7] = 0; | |
| 14745 | ✗ | tempguy.attributes[8] = e9tARMOS; | |
| 14746 | ✗ | } | |
| 14747 | ✗ | else if(tempguy.family == eeGHINI && !tempguy.attributes[0]) | |
| 14748 | { | ||
| 14749 | ✗ | tempguy.family=eeWALK; | |
| 14750 | ✗ | tempguy.hrate = 0; | |
| 14751 | ✗ | tempguy.attributes[0] = tempguy.attributes[1] = tempguy.attributes[2] = tempguy.attributes[3] = tempguy.attributes[4] = tempguy.attributes[5] = | |
| 14752 | ✗ | tempguy.attributes[6] = tempguy.attributes[7] = tempguy.attributes[8] = tempguy.attributes[9] = 0; | |
| 14753 | ✗ | } | |
| 14754 | |||
| 14755 | // Spawn animation flags | ||
| 14756 | ✗ | if(tempguy.family == eeWALK && (tempguy.flags&guy_armos || tempguy.flags&guy_ghini)) | |
| 14757 | ✗ | tempguy.flags |= guy_fade_flicker; | |
| 14758 | else | ||
| 14759 | ✗ | tempguy.flags &= (guy_flags)0x0F00000F; // Get rid of the unused flags! | |
| 14760 | ✗ | } | |
| 14761 | |||
| 14762 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(guyversion < 20) // April 2010 |
| 14763 | { | ||
| 14764 | ✗ | if(tempguy.family == eeTRAP) | |
| 14765 | { | ||
| 14766 | ✗ | tempguy.attributes[1] = tempguy.attributes[9]; | |
| 14767 | |||
| 14768 | ✗ | if(tempguy.attributes[9]>=1) | |
| 14769 | { | ||
| 14770 | ✗ | tempguy.attributes[0]++; | |
| 14771 | ✗ | } | |
| 14772 | |||
| 14773 | ✗ | tempguy.attributes[9] = 0; | |
| 14774 | ✗ | } | |
| 14775 | |||
| 14776 | // Bomb Blast fix | ||
| 14777 | ✗ | if(tempguy.weapon==ewBomb && tempguy.family!=eeROPE && (tempguy.family!=eeWALK || tempguy.attributes[1] != e2tBOMBCHU)) | |
| 14778 | ✗ | tempguy.weapon = ewLitBomb; | |
| 14779 | ✗ | else if(tempguy.weapon==ewSBomb && tempguy.family!=eeROPE && (tempguy.family!=eeWALK || tempguy.attributes[1] != e2tBOMBCHU)) | |
| 14780 | ✗ | tempguy.weapon = ewLitSBomb; | |
| 14781 | ✗ | } | |
| 14782 | |||
| 14783 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(guyversion < 21) // September 2011 |
| 14784 | { | ||
| 14785 | ✗ | if(tempguy.family == eeKEESE || tempguy.family == eeKEESETRIB) | |
| 14786 | { | ||
| 14787 | ✗ | if(tempguy.family == eeKEESETRIB) | |
| 14788 | { | ||
| 14789 | ✗ | tempguy.family = eeKEESE; | |
| 14790 | ✗ | tempguy.attributes[1] = e2tKEESETRIB; | |
| 14791 | ✗ | tempguy.attributes[0] = 0; | |
| 14792 | ✗ | } | |
| 14793 | |||
| 14794 | ✗ | tempguy.rate = 2; | |
| 14795 | ✗ | tempguy.hrate = 8; | |
| 14796 | ✗ | tempguy.homing = 0; | |
| 14797 | ✗ | tempguy.step= (tempguy.family == eeKEESE && tempguy.attributes[0] ? 100:62); | |
| 14798 | ✗ | } | |
| 14799 | ✗ | else if(tempguy.family == eePEAHAT || tempguy.family==eePATRA) | |
| 14800 | { | ||
| 14801 | ✗ | if(tempguy.family == eePEAHAT) | |
| 14802 | { | ||
| 14803 | ✗ | tempguy.rate = 4; | |
| 14804 | ✗ | tempguy.step = 62; | |
| 14805 | ✗ | } | |
| 14806 | else | ||
| 14807 | ✗ | tempguy.step = 25; | |
| 14808 | |||
| 14809 | ✗ | tempguy.hrate = 8; | |
| 14810 | ✗ | tempguy.homing = 0; | |
| 14811 | ✗ | } | |
| 14812 | ✗ | else if(tempguy.family == eeDIG || tempguy.family == eeMANHAN) | |
| 14813 | { | ||
| 14814 | ✗ | if(tempguy.family == eeMANHAN) | |
| 14815 | ✗ | tempguy.step=50; | |
| 14816 | |||
| 14817 | ✗ | tempguy.hrate = 16; | |
| 14818 | ✗ | tempguy.homing = 0; | |
| 14819 | ✗ | } | |
| 14820 | ✗ | else if(tempguy.family == eeGLEEOK) | |
| 14821 | { | ||
| 14822 | ✗ | tempguy.rate = 2; | |
| 14823 | ✗ | tempguy.homing = 0; | |
| 14824 | ✗ | tempguy.hrate = 9; | |
| 14825 | ✗ | tempguy.step=89; | |
| 14826 | ✗ | } | |
| 14827 | ✗ | else if(tempguy.family == eeGHINI) | |
| 14828 | { | ||
| 14829 | ✗ | tempguy.rate = 4; | |
| 14830 | ✗ | tempguy.hrate = 12; | |
| 14831 | ✗ | tempguy.step=62; | |
| 14832 | ✗ | tempguy.homing = 0; | |
| 14833 | ✗ | } | |
| 14834 | |||
| 14835 | // Bigdig random rate fix | ||
| 14836 | ✗ | if(tempguy.family==eeDIG && tempguy.attributes[9]==1) | |
| 14837 | { | ||
| 14838 | ✗ | tempguy.rate = 2; | |
| 14839 | ✗ | } | |
| 14840 | ✗ | } | |
| 14841 | |||
| 14842 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(guyversion < 24) // November 2012 |
| 14843 | { | ||
| 14844 | ✗ | if(tempguy.family==eeLANM) | |
| 14845 | ✗ | tempguy.attributes[2] = 1; | |
| 14846 | ✗ | else if(tempguy.family==eeMOLD) | |
| 14847 | ✗ | tempguy.attributes[1] = 0; | |
| 14848 | ✗ | } | |
| 14849 | |||
| 14850 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 96768 times.
|
169984 | if(guyversion < 33) //Whistle defence did not exist before this version of 2.54. -Z |
| 14851 | { | ||
| 14852 |
2/2✓ Branch 0 taken 1339 times.
✓ Branch 1 taken 95429 times.
|
96768 | if(tempguy.family!=eeDIG) |
| 14853 | { | ||
| 14854 | 95429 | tempguy.defense[edefWhistle] = edIGNORE; //Might need to be ignore, universally. | |
| 14855 | 95429 | } | |
| 14856 | |||
| 14857 | 96768 | } | |
| 14858 | // does not seem to solve the issue! | ||
| 14859 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if ( Header->zelda_version <= 0x210 ) |
| 14860 | { | ||
| 14861 | ✗ | al_trace("Detected version %d for dodongo patch.\n",Header->zelda_version); | |
| 14862 | ✗ | if ( tempguy.family == eeDONGO ) | |
| 14863 | { | ||
| 14864 | ✗ | tempguy.deadsfx = 15; //In 2.10 and earlier, Dodongos used this as their death sound. | |
| 14865 | ✗ | } | |
| 14866 | ✗ | } | |
| 14867 | |||
| 14868 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 96768 times.
|
169984 | if(guyversion >= 42) |
| 14869 | { | ||
| 14870 |
2/2✓ Branch 0 taken 70656 times.
✓ Branch 1 taken 2560 times.
|
73216 | if(guyversion >= 47) |
| 14871 | { | ||
| 14872 |
1/2✓ Branch 0 taken 70656 times.
✗ Branch 1 not taken.
|
70656 | if(!p_igetl(&(tempguy.moveflags),f)) |
| 14873 | { | ||
| 14874 | ✗ | return qe_invalid; | |
| 14875 | } | ||
| 14876 | 70656 | } | |
| 14877 | else | ||
| 14878 | { | ||
| 14879 | byte fl; | ||
| 14880 |
1/2✓ Branch 0 taken 2560 times.
✗ Branch 1 not taken.
|
2560 | if(!p_getc(&fl,f)) |
| 14881 | { | ||
| 14882 | ✗ | return qe_invalid; | |
| 14883 | } | ||
| 14884 | 2560 | tempguy.moveflags = (move_flags)fl; | |
| 14885 | } | ||
| 14886 | 73216 | } | |
| 14887 | else | ||
| 14888 | { | ||
| 14889 |
7/8✓ Branch 0 taken 2771 times.
✓ Branch 1 taken 76150 times.
✓ Branch 2 taken 2607 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 922 times.
✓ Branch 5 taken 611 times.
✓ Branch 6 taken 475 times.
✓ Branch 7 taken 13232 times.
|
96768 | switch(tempguy.family) |
| 14890 | { | ||
| 14891 | //No gravity; floats over pits | ||
| 14892 | case eeTEK: case eePEAHAT: case eeROCK: case eeTRAP: | ||
| 14893 | case eePROJECTILE: case eeSPINTILE: case eeKEESE: case eeFIRE: | ||
| 14894 | //Special (bosses, etc) | ||
| 14895 | case eeFAIRY: case eeGUY: case eeNONE: case eeZORA: | ||
| 14896 | case eeAQUA: case eeDIG: case eeGHOMA: case eeGANON: | ||
| 14897 | case eePATRA: case eeGLEEOK: case eeMOLD: case eeMANHAN: | ||
| 14898 | 76150 | tempguy.moveflags = move_can_pitwalk; | |
| 14899 | 76150 | break; | |
| 14900 | //No gravity, but falls in pits | ||
| 14901 | case eeLEV: | ||
| 14902 | 922 | tempguy.moveflags = move_can_pitfall; | |
| 14903 | 922 | break; | |
| 14904 | //Bosses that respect pits | ||
| 14905 | case eeDONGO: | ||
| 14906 | 611 | tempguy.moveflags = move_obeys_grav; | |
| 14907 | 611 | break; | |
| 14908 | case eeLANM: | ||
| 14909 | 475 | tempguy.moveflags = move_none; | |
| 14910 | 475 | break; | |
| 14911 | //Gravity, floats over pits | ||
| 14912 | case eeWIZZ: case eeWALLM: case eeGHINI: | ||
| 14913 | 2607 | tempguy.moveflags = move_obeys_grav | move_can_pitwalk; | |
| 14914 | 2607 | break; | |
| 14915 | //Gravity and falls in pits | ||
| 14916 | case eeWALK: | ||
| 14917 |
4/4✓ Branch 0 taken 12569 times.
✓ Branch 1 taken 663 times.
✓ Branch 2 taken 508 times.
✓ Branch 3 taken 12061 times.
|
13232 | if (tempguy.attributes[8]==e9tPOLSVOICE||tempguy.attributes[8]==e9tVIRE) |
| 14918 | 1171 | break; | |
| 14919 | [[fallthrough]]; | ||
| 14920 | case eeOTHER: | ||
| 14921 | case eeSCRIPT01: case eeSCRIPT02: case eeSCRIPT03: case eeSCRIPT04: case eeSCRIPT05: | ||
| 14922 | case eeSCRIPT06: case eeSCRIPT07: case eeSCRIPT08: case eeSCRIPT09: case eeSCRIPT10: | ||
| 14923 | case eeSCRIPT11: case eeSCRIPT12: case eeSCRIPT13: case eeSCRIPT14: case eeSCRIPT15: | ||
| 14924 | case eeSCRIPT16: case eeSCRIPT17: case eeSCRIPT18: case eeSCRIPT19: case eeSCRIPT20: | ||
| 14925 | case eeFFRIENDLY01: case eeFFRIENDLY02: case eeFFRIENDLY03: case eeFFRIENDLY04: case eeFFRIENDLY05: | ||
| 14926 | case eeFFRIENDLY06: case eeFFRIENDLY07: case eeFFRIENDLY08: case eeFFRIENDLY09: case eeFFRIENDLY10: | ||
| 14927 | 14832 | tempguy.moveflags = move_obeys_grav | move_can_pitfall; | |
| 14928 | 14832 | } | |
| 14929 | } | ||
| 14930 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 96768 times.
|
169984 | if(guyversion < 43) |
| 14931 | { | ||
| 14932 |
2/2✓ Branch 0 taken 78757 times.
✓ Branch 1 taken 18011 times.
|
96768 | switch(tempguy.family) |
| 14933 | { | ||
| 14934 | //No gravity; floats over pits | ||
| 14935 | case eeTEK: case eePEAHAT: case eeROCK: case eeTRAP: | ||
| 14936 | case eePROJECTILE: case eeSPINTILE: case eeKEESE: case eeFIRE: | ||
| 14937 | //Special (bosses, etc) | ||
| 14938 | case eeFAIRY: case eeGUY: case eeNONE: case eeZORA: | ||
| 14939 | case eeAQUA: case eeDIG: case eeGHOMA: case eeGANON: | ||
| 14940 | case eePATRA: case eeGLEEOK: case eeMOLD: case eeMANHAN: | ||
| 14941 | case eeWIZZ: case eeWALLM: case eeGHINI: | ||
| 14942 | //Gravity, floats over pits | ||
| 14943 | 78757 | tempguy.moveflags |= move_can_waterwalk; | |
| 14944 | 78757 | tempguy.moveflags |= move_can_pitwalk; | |
| 14945 | 78757 | break; | |
| 14946 | } | ||
| 14947 | 96768 | } | |
| 14948 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 96768 times.
|
169984 | if (guyversion < 44) |
| 14949 | { | ||
| 14950 |
2/2✓ Branch 0 taken 95897 times.
✓ Branch 1 taken 871 times.
|
96768 | if ( tempguy.family == eeGHOMA ) |
| 14951 | { | ||
| 14952 | 871 | tempguy.flags |= guy_fade_instant; | |
| 14953 | 871 | } | |
| 14954 | 96768 | } | |
| 14955 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 96768 times.
|
169984 | if (guyversion > 44) |
| 14956 | { | ||
| 14957 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_getc(&(tempguy.spr_shadow),f)) |
| 14958 | { | ||
| 14959 | ✗ | return qe_invalid; | |
| 14960 | } | ||
| 14961 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_getc(&(tempguy.spr_death),f)) |
| 14962 | { | ||
| 14963 | ✗ | return qe_invalid; | |
| 14964 | } | ||
| 14965 |
1/2✓ Branch 0 taken 73216 times.
✗ Branch 1 not taken.
|
73216 | if(!p_getc(&(tempguy.spr_spawn),f)) |
| 14966 | { | ||
| 14967 | ✗ | return qe_invalid; | |
| 14968 | } | ||
| 14969 | 73216 | } | |
| 14970 | else | ||
| 14971 | { | ||
| 14972 |
2/2✓ Branch 0 taken 96392 times.
✓ Branch 1 taken 376 times.
|
96768 | tempguy.spr_shadow = (tempguy.family==eeROCK && tempguy.attributes[9]==1) ? iwLargeShadow : iwShadow; |
| 14973 | 96768 | tempguy.spr_death = iwDeath; | |
| 14974 | 96768 | tempguy.spr_spawn = iwSpawn; | |
| 14975 | } | ||
| 14976 | |||
| 14977 |
2/2✓ Branch 0 taken 73216 times.
✓ Branch 1 taken 96768 times.
|
169984 | if(guyversion < 46) |
| 14978 | { | ||
| 14979 |
4/4✓ Branch 0 taken 13232 times.
✓ Branch 1 taken 83536 times.
✓ Branch 2 taken 12569 times.
✓ Branch 3 taken 663 times.
|
96768 | if(tempguy.family == eeWALK && tempguy.attributes[8] == e9tPOLSVOICE) |
| 14980 | { | ||
| 14981 | 663 | tempguy.moveflags |= move_can_waterwalk; | |
| 14982 | 663 | } | |
| 14983 | 96768 | } | |
| 14984 | |||
| 14985 |
2/2✓ Branch 0 taken 70656 times.
✓ Branch 1 taken 99328 times.
|
169984 | if (guyversion < 47) |
| 14986 | { | ||
| 14987 |
4/4✓ Branch 0 taken 1369 times.
✓ Branch 1 taken 97959 times.
✓ Branch 2 taken 816 times.
✓ Branch 3 taken 553 times.
|
99328 | if (tempguy.family == eeDIG && tempguy.attributes[9]!=1) |
| 14988 | { | ||
| 14989 | 553 | tempguy.flags |= guy_ignore_kill_all; | |
| 14990 | 553 | } | |
| 14991 | 99328 | } | |
| 14992 | |||
| 14993 |
2/2✓ Branch 0 taken 52224 times.
✓ Branch 1 taken 117760 times.
|
169984 | if (guyversion < 48) |
| 14994 | { | ||
| 14995 |
8/8✓ Branch 0 taken 15588 times.
✓ Branch 1 taken 102172 times.
✓ Branch 2 taken 15143 times.
✓ Branch 3 taken 445 times.
✓ Branch 4 taken 14686 times.
✓ Branch 5 taken 457 times.
✓ Branch 6 taken 501 times.
✓ Branch 7 taken 14185 times.
|
117760 | if (tempguy.family == eeWALK && (tempguy.attributes[6]==e7tPERMJINX || tempguy.attributes[6]==e7tTEMPJINX || tempguy.attributes[6]==e7tUNJINX)) //BUBBLE CHECK |
| 14996 | { | ||
| 14997 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 670 times.
✓ Branch 2 taken 673 times.
✓ Branch 3 taken 60 times.
|
1403 | switch (tempguy.attributes[7]) { |
| 14998 | case 0: //Sword | ||
| 14999 | 670 | tempguy.attributes[7] = e8tSWORD; | |
| 15000 | 670 | break; | |
| 15001 | case 1: //Item | ||
| 15002 | 673 | tempguy.attributes[7] = e8tITEM; | |
| 15003 | 673 | break; | |
| 15004 | case 2: //Both | ||
| 15005 | 60 | tempguy.attributes[7] = e8tSWORD|e8tITEM; | |
| 15006 | 60 | break; | |
| 15007 | default: //this can actually happen since Misc8 can be set to any number. | ||
| 15008 | ✗ | tempguy.attributes[7] = 0; | |
| 15009 | ✗ | break; | |
| 15010 | } | ||
| 15011 | 1403 | } | |
| 15012 | 117760 | } | |
| 15013 | |||
| 15014 | //these could possible be combined but rather be safe... | ||
| 15015 |
2/2✓ Branch 0 taken 52224 times.
✓ Branch 1 taken 117760 times.
|
169984 | if (guyversion < 51) //reimport the firesfx, zoria ducked up. |
| 15016 | { | ||
| 15017 | 117760 | guy_update_firesfx(tempguy); | |
| 15018 | 117760 | } | |
| 15019 |
2/2✓ Branch 0 taken 117760 times.
✓ Branch 1 taken 52224 times.
|
169984 | if (guyversion < 52) |
| 15020 | { | ||
| 15021 | 117760 | guy_update_weaponflags(tempguy); | |
| 15022 | 117760 | } | |
| 15023 | else | ||
| 15024 | { | ||
| 15025 |
1/2✓ Branch 0 taken 52224 times.
✗ Branch 1 not taken.
|
52224 | if (!p_getc(&(tempguy.wunblockable), f)) |
| 15026 | ✗ | return qe_invalid; | |
| 15027 |
1/2✓ Branch 0 taken 52224 times.
✗ Branch 1 not taken.
|
52224 | if (!p_igetl(&(tempguy.wmoveflags), f)) |
| 15028 | ✗ | return qe_invalid; | |
| 15029 |
1/2✓ Branch 0 taken 52224 times.
✗ Branch 1 not taken.
|
52224 | if (!p_igetl(&(tempguy.weapoverrideFLAGS), f)) |
| 15030 | ✗ | return qe_invalid; | |
| 15031 |
1/2✓ Branch 0 taken 52224 times.
✗ Branch 1 not taken.
|
52224 | if (!p_igetl(&(tempguy.weap_tilew), f)) |
| 15032 | ✗ | return qe_invalid; | |
| 15033 |
1/2✓ Branch 0 taken 52224 times.
✗ Branch 1 not taken.
|
52224 | if (!p_igetl(&(tempguy.weap_tileh), f)) |
| 15034 | ✗ | return qe_invalid; | |
| 15035 |
1/2✓ Branch 0 taken 52224 times.
✗ Branch 1 not taken.
|
52224 | if (!p_igetl(&(tempguy.weap_hxsz), f)) |
| 15036 | ✗ | return qe_invalid; | |
| 15037 |
1/2✓ Branch 0 taken 52224 times.
✗ Branch 1 not taken.
|
52224 | if (!p_igetl(&(tempguy.weap_hysz), f)) |
| 15038 | ✗ | return qe_invalid; | |
| 15039 |
1/2✓ Branch 0 taken 52224 times.
✗ Branch 1 not taken.
|
52224 | if (!p_igetl(&(tempguy.weap_hzsz), f)) |
| 15040 | ✗ | return qe_invalid; | |
| 15041 |
1/2✓ Branch 0 taken 52224 times.
✗ Branch 1 not taken.
|
52224 | if (!p_igetl(&(tempguy.weap_hxofs), f)) |
| 15042 | ✗ | return qe_invalid; | |
| 15043 |
1/2✓ Branch 0 taken 52224 times.
✗ Branch 1 not taken.
|
52224 | if (!p_igetl(&(tempguy.weap_hyofs), f)) |
| 15044 | ✗ | return qe_invalid; | |
| 15045 |
1/2✓ Branch 0 taken 52224 times.
✗ Branch 1 not taken.
|
52224 | if (!p_igetl(&(tempguy.weap_xofs), f)) |
| 15046 | ✗ | return qe_invalid; | |
| 15047 |
1/2✓ Branch 0 taken 52224 times.
✗ Branch 1 not taken.
|
52224 | if (!p_igetl(&(tempguy.weap_yofs), f)) |
| 15048 | ✗ | return qe_invalid; | |
| 15049 |
1/2✓ Branch 0 taken 52224 times.
✗ Branch 1 not taken.
|
52224 | if (!p_igetl(&(tempguy.wstep), f)) |
| 15050 | ✗ | return qe_invalid; | |
| 15051 |
2/2✓ Branch 0 taken 261120 times.
✓ Branch 1 taken 52224 times.
|
313344 | for (int32_t q = 0; q < WPNSPR_MAX; ++q) |
| 15052 | { | ||
| 15053 |
1/2✓ Branch 0 taken 261120 times.
✗ Branch 1 not taken.
|
261120 | if (!p_igetw(&(tempguy.burnsprs[q]), f)) |
| 15054 | ✗ | return qe_invalid; | |
| 15055 |
1/2✓ Branch 0 taken 261120 times.
✗ Branch 1 not taken.
|
261120 | if (!p_igetw(&(tempguy.light_rads[q]), f)) |
| 15056 | ✗ | return qe_invalid; | |
| 15057 | 261120 | } | |
| 15058 | } | ||
| 15059 |
2/2✓ Branch 0 taken 117760 times.
✓ Branch 1 taken 52224 times.
|
169984 | if (guyversion < 53) |
| 15060 | { | ||
| 15061 | 117760 | guy_update_weaponspecialsfx(tempguy); | |
| 15062 | 117760 | } | |
| 15063 | else | ||
| 15064 | { | ||
| 15065 |
1/2✓ Branch 0 taken 52224 times.
✗ Branch 1 not taken.
|
52224 | if (!p_getc(&(tempguy.specialsfx), f)) |
| 15066 | ✗ | return qe_invalid; | |
| 15067 | } | ||
| 15068 | |||
| 15069 |
1/2✓ Branch 0 taken 169984 times.
✗ Branch 1 not taken.
|
169984 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 15070 | { | ||
| 15071 | ✗ | tempguy.script = 0; | |
| 15072 | ✗ | for(int q = 0; q < 8; ++q) | |
| 15073 | ✗ | tempguy.initD[q] = 0; | |
| 15074 | ✗ | } | |
| 15075 | 169984 | guysbuf[i] = tempguy; | |
| 15076 | 169984 | } | |
| 15077 | 332 | } | |
| 15078 | |||
| 15079 | 332 | return 0; | |
| 15080 | 414 | } | |
| 15081 | |||
| 15082 | ✗ | void update_guy_1(guydata *tempguy) // November 2009 | |
| 15083 | { | ||
| 15084 | ✗ | bool doesntcount = false; | |
| 15085 | ✗ | tempguy->flags &= ~guy_weak_arrow; // Formerly 'weak to arrow' which wasn't implemented | |
| 15086 | |||
| 15087 | ✗ | switch(tempguy->family) | |
| 15088 | { | ||
| 15089 | case 1: //eeWALK | ||
| 15090 | ✗ | switch(tempguy->attributes[9]) | |
| 15091 | { | ||
| 15092 | case 0: //Stalfos | ||
| 15093 | ✗ | if(tempguy->attributes[0]==1) // Fires four projectiles at once | |
| 15094 | ✗ | tempguy->attributes[0]=4; | |
| 15095 | |||
| 15096 | ✗ | break; | |
| 15097 | |||
| 15098 | case 1: //Darknut | ||
| 15099 | ✗ | goto darknuts; | |
| 15100 | break; | ||
| 15101 | } | ||
| 15102 | |||
| 15103 | ✗ | tempguy->attributes[9] = 0; | |
| 15104 | ✗ | break; | |
| 15105 | |||
| 15106 | case 2: //eeSHOOT | ||
| 15107 | ✗ | tempguy->family = eeWALK; | |
| 15108 | |||
| 15109 | ✗ | switch(tempguy->attributes[9]) | |
| 15110 | { | ||
| 15111 | case 0: //Octorok | ||
| 15112 | ✗ | if(tempguy->attributes[0]==1||tempguy->attributes[0]==2) | |
| 15113 | { | ||
| 15114 | ✗ | tempguy->attributes[0]=e1tFIREOCTO; | |
| 15115 | ✗ | tempguy->attributes[1]=e2tFIREOCTO; | |
| 15116 | ✗ | } | |
| 15117 | ✗ | else tempguy->attributes[0] = 0; | |
| 15118 | |||
| 15119 | ✗ | tempguy->attributes[5]=tempguy->attributes[3]; | |
| 15120 | ✗ | tempguy->attributes[3]=tempguy->attributes[2]; | |
| 15121 | ✗ | tempguy->attributes[2]=0; | |
| 15122 | ✗ | break; | |
| 15123 | |||
| 15124 | case 1: // Moblin | ||
| 15125 | ✗ | tempguy->attributes[0] = 0; | |
| 15126 | ✗ | break; | |
| 15127 | |||
| 15128 | case 2: //Lynel | ||
| 15129 | ✗ | tempguy->attributes[5]=tempguy->attributes[0]+1; | |
| 15130 | ✗ | tempguy->attributes[0]=0; | |
| 15131 | ✗ | break; | |
| 15132 | |||
| 15133 | case 3: //Stalfos 2 | ||
| 15134 | ✗ | if(tempguy->attributes[0]==1) // Fires four projectiles at once | |
| 15135 | ✗ | tempguy->attributes[0]=e1t4SHOTS; | |
| 15136 | ✗ | else tempguy->attributes[0] = 0; | |
| 15137 | |||
| 15138 | ✗ | break; | |
| 15139 | |||
| 15140 | case 4: //Darknut 5 | ||
| 15141 | darknuts: | ||
| 15142 | ✗ | tempguy->defense[edefFIRE] = edIGNORE; | |
| 15143 | ✗ | tempguy->defense[edefBRANG] = edSTUNORCHINK; | |
| 15144 | ✗ | tempguy->defense[edefHOOKSHOT] = 0; | |
| 15145 | ✗ | tempguy->defense[edefARROW] = tempguy->defense[edefBYRNA] = tempguy->defense[edefREFROCK] = | |
| 15146 | ✗ | tempguy->defense[edefMAGIC] = tempguy->defense[edefSTOMP] = edCHINK; | |
| 15147 | |||
| 15148 | ✗ | if(tempguy->attributes[0]==1) | |
| 15149 | ✗ | tempguy->attributes[0]=2; | |
| 15150 | ✗ | else if(tempguy->attributes[0]==2) | |
| 15151 | { | ||
| 15152 | ✗ | tempguy->attributes[3]=tempguy->attributes[2]; | |
| 15153 | ✗ | tempguy->attributes[2]=tempguy->attributes[1]; | |
| 15154 | ✗ | tempguy->attributes[1]=e2tSPLIT; | |
| 15155 | ✗ | tempguy->attributes[0] = 0; | |
| 15156 | ✗ | } | |
| 15157 | ✗ | else tempguy->attributes[0] = 0; | |
| 15158 | |||
| 15159 | ✗ | tempguy->flags |= guy_shield_front; | |
| 15160 | |||
| 15161 | ✗ | if(!get_bit(deprecated_rules,qr_BRKBLSHLDS_DEP)) | |
| 15162 | ✗ | tempguy->flags &= ~guy_bkshield; | |
| 15163 | else | ||
| 15164 | ✗ | tempguy->flags |= guy_bkshield; | |
| 15165 | |||
| 15166 | ✗ | break; | |
| 15167 | } | ||
| 15168 | |||
| 15169 | ✗ | tempguy->attributes[9] = 0; | |
| 15170 | ✗ | break; | |
| 15171 | |||
| 15172 | /* | ||
| 15173 | case 9: //eeARMOS | ||
| 15174 | tempguy->family = eeWALK; | ||
| 15175 | break; | ||
| 15176 | */ | ||
| 15177 | case 11: //eeGEL | ||
| 15178 | case 33: //eeGELTRIB | ||
| 15179 | ✗ | if(tempguy->family==33) | |
| 15180 | { | ||
| 15181 | ✗ | tempguy->attributes[3] = 1; | |
| 15182 | |||
| 15183 | ✗ | if(get_bit(deprecated_rules, qr_OLDTRIBBLES_DEP)) //Old Tribbles | |
| 15184 | ✗ | tempguy->attributes[2] = tempguy->attributes[1]; | |
| 15185 | |||
| 15186 | ✗ | tempguy->attributes[1] = e2tTRIBBLE; | |
| 15187 | ✗ | } | |
| 15188 | else | ||
| 15189 | { | ||
| 15190 | ✗ | tempguy->attributes[3] = 0; | |
| 15191 | ✗ | tempguy->attributes[2] = 0; | |
| 15192 | ✗ | tempguy->attributes[1] = 0; | |
| 15193 | } | ||
| 15194 | |||
| 15195 | ✗ | tempguy->family = eeWALK; | |
| 15196 | |||
| 15197 | ✗ | if(tempguy->attributes[0]) | |
| 15198 | { | ||
| 15199 | ✗ | tempguy->attributes[0]=1; | |
| 15200 | ✗ | tempguy->weapon = ewFireTrail; | |
| 15201 | ✗ | } | |
| 15202 | |||
| 15203 | ✗ | break; | |
| 15204 | |||
| 15205 | case 34: //eeZOLTRIB | ||
| 15206 | case 12: //eeZOL | ||
| 15207 | ✗ | tempguy->attributes[3]=tempguy->attributes[2]; | |
| 15208 | ✗ | tempguy->attributes[2]=tempguy->attributes[1]; | |
| 15209 | ✗ | tempguy->family = eeWALK; | |
| 15210 | ✗ | tempguy->attributes[1]=e2tSPLITHIT; | |
| 15211 | |||
| 15212 | ✗ | if(tempguy->attributes[0]) | |
| 15213 | { | ||
| 15214 | ✗ | tempguy->attributes[0]=1; | |
| 15215 | ✗ | tempguy->weapon = ewFireTrail; | |
| 15216 | ✗ | } | |
| 15217 | |||
| 15218 | ✗ | break; | |
| 15219 | |||
| 15220 | case 13: //eeROPE | ||
| 15221 | ✗ | tempguy->family = eeWALK; | |
| 15222 | ✗ | tempguy->attributes[8] = e9tROPE; | |
| 15223 | |||
| 15224 | ✗ | if(tempguy->attributes[0]) | |
| 15225 | { | ||
| 15226 | ✗ | tempguy->attributes[3] = tempguy->attributes[2]; | |
| 15227 | ✗ | tempguy->attributes[2] = tempguy->attributes[1]; | |
| 15228 | ✗ | tempguy->attributes[1] = e2tBOMBCHU; | |
| 15229 | ✗ | } | |
| 15230 | |||
| 15231 | ✗ | tempguy->attributes[0] = 0; | |
| 15232 | ✗ | break; | |
| 15233 | |||
| 15234 | case 14: //eeGORIYA | ||
| 15235 | ✗ | tempguy->family = eeWALK; | |
| 15236 | |||
| 15237 | ✗ | if(tempguy->attributes[0]!=2) tempguy->attributes[0] = 0; | |
| 15238 | |||
| 15239 | ✗ | break; | |
| 15240 | |||
| 15241 | case 17: //eeBUBBLE | ||
| 15242 | ✗ | tempguy->family = eeWALK; | |
| 15243 | ✗ | tempguy->attributes[7] = tempguy->attributes[1]; | |
| 15244 | ✗ | tempguy->attributes[6] = tempguy->attributes[0] + 1; | |
| 15245 | ✗ | tempguy->attributes[0] = tempguy->attributes[1] = 0; | |
| 15246 | |||
| 15247 | //fallthrogh | ||
| 15248 | case eeTRAP: | ||
| 15249 | case eeROCK: | ||
| 15250 | ✗ | doesntcount = true; | |
| 15251 | ✗ | break; | |
| 15252 | |||
| 15253 | case 35: //eeVIRETRIB | ||
| 15254 | case 18: //eeVIRE | ||
| 15255 | ✗ | tempguy->family = eeWALK; | |
| 15256 | ✗ | tempguy->attributes[3]=tempguy->attributes[2]; | |
| 15257 | ✗ | tempguy->attributes[2]=tempguy->attributes[1]; | |
| 15258 | ✗ | tempguy->attributes[1]=e2tSPLITHIT; | |
| 15259 | ✗ | tempguy->attributes[8]=e9tVIRE; | |
| 15260 | ✗ | break; | |
| 15261 | |||
| 15262 | case 19: //eeLIKE | ||
| 15263 | ✗ | tempguy->family = eeWALK; | |
| 15264 | ✗ | tempguy->attributes[6] = e7tEATITEMS; | |
| 15265 | ✗ | tempguy->attributes[7]=95; | |
| 15266 | ✗ | break; | |
| 15267 | |||
| 15268 | case 20: //eePOLSV | ||
| 15269 | ✗ | tempguy->defense[edefBRANG] = edSTUNORCHINK; | |
| 15270 | ✗ | tempguy->defense[edefBOMB] = tempguy->defense[edefSBOMB] = tempguy->defense[edefFIRE] = edIGNORE; | |
| 15271 | ✗ | tempguy->defense[edefMAGIC] = tempguy->defense[edefBYRNA] = edCHINK; | |
| 15272 | ✗ | tempguy->defense[edefARROW] = ed1HKO; | |
| 15273 | ✗ | tempguy->defense[edefHOOKSHOT] = edSTUNONLY; | |
| 15274 | ✗ | tempguy->family = eeWALK; | |
| 15275 | ✗ | tempguy->attributes[8] = e9tPOLSVOICE; | |
| 15276 | ✗ | tempguy->rate = 4; | |
| 15277 | ✗ | tempguy->homing = 32; | |
| 15278 | ✗ | tempguy->hrate = 10; | |
| 15279 | ✗ | tempguy->grumble = 0; | |
| 15280 | ✗ | break; | |
| 15281 | |||
| 15282 | case eeWIZZ: | ||
| 15283 | ✗ | if(tempguy->attributes[3]) | |
| 15284 | { | ||
| 15285 | ✗ | for(int32_t i=0; i < edefLAST; i++) | |
| 15286 | ✗ | tempguy->defense[i] = (i != edefREFBEAM && i != edefREFMAGIC && i != edefQUAKE) ? edIGNORE : 0; | |
| 15287 | ✗ | } | |
| 15288 | else | ||
| 15289 | { | ||
| 15290 | ✗ | tempguy->defense[edefBRANG] = edSTUNORCHINK; | |
| 15291 | ✗ | tempguy->defense[edefMAGIC] = edCHINK; | |
| 15292 | ✗ | tempguy->defense[edefHOOKSHOT] = edSTUNONLY; | |
| 15293 | ✗ | tempguy->defense[edefARROW] = tempguy->defense[edefFIRE] = | |
| 15294 | ✗ | tempguy->defense[edefWAND] = tempguy->defense[edefBYRNA] = edIGNORE; | |
| 15295 | } | ||
| 15296 | |||
| 15297 | ✗ | break; | |
| 15298 | |||
| 15299 | case eePEAHAT: | ||
| 15300 | ✗ | tempguy->flags &= ~(guy_superman|guy_sbombonly); | |
| 15301 | |||
| 15302 | ✗ | if(!(tempguy->flags & guy_bhit)) | |
| 15303 | ✗ | tempguy->defense[edefBRANG] = edSTUNONLY; | |
| 15304 | |||
| 15305 | ✗ | break; | |
| 15306 | |||
| 15307 | case eeLEV: | ||
| 15308 | ✗ | tempguy->defense[edefSTOMP] = edCHINK; | |
| 15309 | ✗ | break; | |
| 15310 | } | ||
| 15311 | |||
| 15312 | // Old flags | ||
| 15313 | ✗ | if(tempguy->flags & guy_superman) | |
| 15314 | { | ||
| 15315 | ✗ | for(int32_t i = 0; i < edefLAST; i++) | |
| 15316 | ✗ | if(!(i==edefSBOMB && (tempguy->flags & guy_sbombonly))) | |
| 15317 | ✗ | tempguy->defense[i] = (i==edefBRANG && tempguy->defense[i] != edIGNORE | |
| 15318 | ✗ | && tempguy->family != eeROCK && tempguy->family != eeTRAP | |
| 15319 | ✗ | && tempguy->family != eePROJECTILE) ? edSTUNORIGNORE : edIGNORE; | |
| 15320 | ✗ | } | |
| 15321 | |||
| 15322 | ✗ | tempguy->flags &= ~(guy_superman|guy_sbombonly); | |
| 15323 | |||
| 15324 | ✗ | if(doesntcount) | |
| 15325 | ✗ | tempguy->flags |= (guy_doesnt_count); | |
| 15326 | ✗ | } | |
| 15327 | |||
| 15328 | 1154920 | int32_t readmapscreen_old(PACKFILE *f, zquestheader *Header, mapscr *temp_mapscr, word version, int scrind) | |
| 15329 | { | ||
| 15330 | byte tempbyte, padding; | ||
| 15331 | int32_t extras, secretcombos; | ||
| 15332 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_getc(&(temp_mapscr->valid),f)) |
| 15333 | { | ||
| 15334 | ✗ | return qe_invalid; | |
| 15335 | } | ||
| 15336 | |||
| 15337 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_getc(&(temp_mapscr->guy),f)) |
| 15338 | ✗ | return qe_invalid; | |
| 15339 | 1154920 | temp_mapscr->guytile = -1; //signal to use default guy values | |
| 15340 |
2/2✓ Branch 0 taken 1154343 times.
✓ Branch 1 taken 577 times.
|
1154920 | SETFLAG(temp_mapscr->roomflags,RFL_ALWAYS_GUY,temp_mapscr->guy==gFAIRY); |
| 15341 |
4/4✓ Branch 0 taken 577 times.
✓ Branch 1 taken 1154343 times.
✓ Branch 2 taken 42 times.
✓ Branch 3 taken 535 times.
|
1154920 | SETFLAG(temp_mapscr->roomflags,RFL_GUYFIRES,temp_mapscr->guy!=gFAIRY || !get_qr(qr_NOFAIRYGUYFIRES)); |
| 15342 | |||
| 15343 |
5/6✓ Branch 0 taken 1132744 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1130024 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1154920 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<146))) |
| 15344 | { | ||
| 15345 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22176 times.
|
22176 | if(!p_getc(&tempbyte,f)) |
| 15346 | { | ||
| 15347 | ✗ | return qe_invalid; | |
| 15348 | } | ||
| 15349 | |||
| 15350 | 22176 | temp_mapscr->str=tempbyte; | |
| 15351 | 22176 | } | |
| 15352 | else | ||
| 15353 | { | ||
| 15354 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1132744 times.
|
1132744 | if(!p_igetw(&(temp_mapscr->str),f)) |
| 15355 | { | ||
| 15356 | ✗ | return qe_invalid; | |
| 15357 | } | ||
| 15358 | } | ||
| 15359 | |||
| 15360 |
1/2✓ Branch 0 taken 1154920 times.
✗ Branch 1 not taken.
|
1154920 | if(!p_getc(&(temp_mapscr->room),f)) |
| 15361 | { | ||
| 15362 | ✗ | return qe_invalid; | |
| 15363 | } | ||
| 15364 | |||
| 15365 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_getc(&(temp_mapscr->item),f)) |
| 15366 | { | ||
| 15367 | ✗ | return qe_invalid; | |
| 15368 | } | ||
| 15369 | |||
| 15370 |
3/6✓ Branch 0 taken 626416 times.
✓ Branch 1 taken 528504 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 626416 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1154920 | if(Header->zelda_version < 0x211 || (Header->zelda_version == 0x211 && Header->build < 14)) |
| 15371 | { | ||
| 15372 | 528504 | temp_mapscr->hasitem = (temp_mapscr->item != 0) ? 1 : 0; | |
| 15373 | 528504 | } | |
| 15374 | else | ||
| 15375 | { | ||
| 15376 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 626416 times.
|
626416 | if(!p_getc(&(temp_mapscr->hasitem),f)) |
| 15377 | ✗ | return qe_invalid; | |
| 15378 | } | ||
| 15379 | |||
| 15380 |
3/4✓ Branch 0 taken 1132744 times.
✓ Branch 1 taken 22176 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2720 times.
|
1157640 | if((Header->zelda_version < 0x192)|| |
| 15381 |
2/2✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1130024 times.
|
1132744 | ((Header->zelda_version == 0x192)&&(Header->build<154))) |
| 15382 | { | ||
| 15383 |
1/2✓ Branch 0 taken 22176 times.
✗ Branch 1 not taken.
|
22176 | if(!p_getc(&tempbyte,f)) |
| 15384 | { | ||
| 15385 | ✗ | return qe_invalid; | |
| 15386 | } | ||
| 15387 | 22176 | } | |
| 15388 | |||
| 15389 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_getc(&(temp_mapscr->tilewarptype[0]),f)) |
| 15390 | { | ||
| 15391 | ✗ | return qe_invalid; | |
| 15392 | } | ||
| 15393 | |||
| 15394 |
2/2✓ Branch 0 taken 1130024 times.
✓ Branch 1 taken 24896 times.
|
1154920 | if(Header->zelda_version < 0x193) |
| 15395 | { | ||
| 15396 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24896 times.
|
24896 | if(!p_getc(&tempbyte,f)) |
| 15397 | { | ||
| 15398 | ✗ | return qe_invalid; | |
| 15399 | } | ||
| 15400 | 24896 | } | |
| 15401 | |||
| 15402 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15403 | { | ||
| 15404 |
2/2✓ Branch 0 taken 1879248 times.
✓ Branch 1 taken 626416 times.
|
2505664 | for(int32_t i=1; i<4; i++) |
| 15405 | { | ||
| 15406 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1879248 times.
|
1879248 | if(!p_getc(&(temp_mapscr->tilewarptype[i]),f)) |
| 15407 | { | ||
| 15408 | ✗ | return qe_invalid; | |
| 15409 | } | ||
| 15410 | 1879248 | } | |
| 15411 | 626416 | } | |
| 15412 | else | ||
| 15413 | { | ||
| 15414 | 528504 | temp_mapscr->tilewarptype[1]=0; | |
| 15415 | 528504 | temp_mapscr->tilewarptype[2]=0; | |
| 15416 | 528504 | temp_mapscr->tilewarptype[3]=0; | |
| 15417 | } | ||
| 15418 | |||
| 15419 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1130024 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>153))) |
| 15420 | { | ||
| 15421 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1132744 times.
|
1132744 | if(!p_igetw(&(temp_mapscr->door_combo_set),f)) |
| 15422 | { | ||
| 15423 | ✗ | return qe_invalid; | |
| 15424 | } | ||
| 15425 | 1132744 | } | |
| 15426 | |||
| 15427 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_getc(&(temp_mapscr->warpreturnx[0]),f)) |
| 15428 | { | ||
| 15429 | ✗ | return qe_invalid; | |
| 15430 | } | ||
| 15431 | |||
| 15432 | 1154920 | temp_mapscr->warpreturnx[1]=0; | |
| 15433 | 1154920 | temp_mapscr->warpreturnx[2]=0; | |
| 15434 | 1154920 | temp_mapscr->warpreturnx[3]=0; | |
| 15435 | |||
| 15436 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15437 | { | ||
| 15438 |
2/2✓ Branch 0 taken 1879248 times.
✓ Branch 1 taken 626416 times.
|
2505664 | for(int32_t i=1; i<4; i++) |
| 15439 | { | ||
| 15440 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1879248 times.
|
1879248 | if(!p_getc(&(temp_mapscr->warpreturnx[i]),f)) |
| 15441 | { | ||
| 15442 | ✗ | return qe_invalid; | |
| 15443 | } | ||
| 15444 | 1879248 | } | |
| 15445 | 626416 | } | |
| 15446 | |||
| 15447 |
1/2✓ Branch 0 taken 1154920 times.
✗ Branch 1 not taken.
|
1154920 | if(!p_getc(&(temp_mapscr->warpreturny[0]),f)) |
| 15448 | { | ||
| 15449 | ✗ | return qe_invalid; | |
| 15450 | } | ||
| 15451 | |||
| 15452 | 1154920 | temp_mapscr->warpreturny[1]=0; | |
| 15453 | 1154920 | temp_mapscr->warpreturny[2]=0; | |
| 15454 | 1154920 | temp_mapscr->warpreturny[3]=0; | |
| 15455 | |||
| 15456 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15457 | { | ||
| 15458 |
2/2✓ Branch 0 taken 1879248 times.
✓ Branch 1 taken 626416 times.
|
2505664 | for(int32_t i=1; i<4; i++) |
| 15459 | { | ||
| 15460 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1879248 times.
|
1879248 | if(!p_getc(&(temp_mapscr->warpreturny[i]),f)) |
| 15461 | { | ||
| 15462 | ✗ | return qe_invalid; | |
| 15463 | } | ||
| 15464 | 1879248 | } | |
| 15465 | |||
| 15466 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(version>=18) |
| 15467 | { | ||
| 15468 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_igetw(&temp_mapscr->warpreturnc,f)) |
| 15469 | { | ||
| 15470 | ✗ | return qe_invalid; | |
| 15471 | } | ||
| 15472 | 626416 | } | |
| 15473 | else | ||
| 15474 | { | ||
| 15475 | byte temp; | ||
| 15476 | |||
| 15477 | ✗ | if(!p_getc(&temp,f)) | |
| 15478 | { | ||
| 15479 | ✗ | return qe_invalid; | |
| 15480 | } | ||
| 15481 | |||
| 15482 | ✗ | temp_mapscr->warpreturnc=temp<<8|temp; | |
| 15483 | } | ||
| 15484 | 626416 | } | |
| 15485 | |||
| 15486 |
1/2✓ Branch 0 taken 1154920 times.
✗ Branch 1 not taken.
|
1154920 | if(!p_getc(&(temp_mapscr->stairx),f)) |
| 15487 | |||
| 15488 | { | ||
| 15489 | ✗ | return qe_invalid; | |
| 15490 | } | ||
| 15491 | |||
| 15492 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_getc(&(temp_mapscr->stairy),f)) |
| 15493 | { | ||
| 15494 | ✗ | return qe_invalid; | |
| 15495 | } | ||
| 15496 | |||
| 15497 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_getc(&(temp_mapscr->itemx),f)) |
| 15498 | { | ||
| 15499 | ✗ | return qe_invalid; | |
| 15500 | } | ||
| 15501 | |||
| 15502 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_getc(&(temp_mapscr->itemy),f)) |
| 15503 | { | ||
| 15504 | ✗ | return qe_invalid; | |
| 15505 | } | ||
| 15506 | |||
| 15507 |
2/2✓ Branch 0 taken 626416 times.
✓ Branch 1 taken 528504 times.
|
1154920 | if(version > 15) // February 2009 |
| 15508 | { | ||
| 15509 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_igetw(&(temp_mapscr->color),f)) |
| 15510 | { | ||
| 15511 | ✗ | return qe_invalid; | |
| 15512 | } | ||
| 15513 | 626416 | } | |
| 15514 | else | ||
| 15515 | { | ||
| 15516 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 528504 times.
|
528504 | if(!p_getc(& tempbyte,f)) |
| 15517 | { | ||
| 15518 | ✗ | return qe_invalid; | |
| 15519 | } | ||
| 15520 | |||
| 15521 | 528504 | temp_mapscr->color = (word) tempbyte; | |
| 15522 | } | ||
| 15523 | |||
| 15524 |
1/2✓ Branch 0 taken 1154920 times.
✗ Branch 1 not taken.
|
1154920 | if(!p_getc(&(temp_mapscr->enemyflags),f)) |
| 15525 | { | ||
| 15526 | ✗ | return qe_invalid; | |
| 15527 | } | ||
| 15528 | |||
| 15529 |
2/2✓ Branch 0 taken 4619680 times.
✓ Branch 1 taken 1154920 times.
|
5774600 | for(int32_t k=0; k<4; k++) |
| 15530 | { | ||
| 15531 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4619680 times.
|
4619680 | if(!p_getc(&(temp_mapscr->door[k]),f)) |
| 15532 | { | ||
| 15533 | ✗ | return qe_invalid; | |
| 15534 | |||
| 15535 | } | ||
| 15536 | 4619680 | } | |
| 15537 | |||
| 15538 |
2/2✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
|
1154920 | if(version <= 11) |
| 15539 | { | ||
| 15540 |
1/2✓ Branch 0 taken 528504 times.
✗ Branch 1 not taken.
|
528504 | if(!p_getc(&(tempbyte),f)) |
| 15541 | { | ||
| 15542 | ✗ | return qe_invalid; | |
| 15543 | } | ||
| 15544 | |||
| 15545 | 528504 | temp_mapscr->tilewarpdmap[0]=(word)tempbyte; | |
| 15546 | |||
| 15547 |
2/6✓ Branch 0 taken 528504 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
528504 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15548 | { | ||
| 15549 | ✗ | for(int32_t i=1; i<4; i++) | |
| 15550 | { | ||
| 15551 | ✗ | if(!p_getc(&(tempbyte),f)) | |
| 15552 | { | ||
| 15553 | ✗ | return qe_invalid; | |
| 15554 | } | ||
| 15555 | |||
| 15556 | ✗ | temp_mapscr->tilewarpdmap[i]=(word)tempbyte; | |
| 15557 | ✗ | } | |
| 15558 | ✗ | } | |
| 15559 | else | ||
| 15560 | { | ||
| 15561 | 528504 | temp_mapscr->tilewarpdmap[1]=0; | |
| 15562 | 528504 | temp_mapscr->tilewarpdmap[2]=0; | |
| 15563 | 528504 | temp_mapscr->tilewarpdmap[3]=0; | |
| 15564 | } | ||
| 15565 | 528504 | } | |
| 15566 | else | ||
| 15567 | { | ||
| 15568 |
2/2✓ Branch 0 taken 2505664 times.
✓ Branch 1 taken 626416 times.
|
3132080 | for(int32_t i=0; i<4; i++) |
| 15569 | { | ||
| 15570 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2505664 times.
|
2505664 | if(!p_igetw(&(temp_mapscr->tilewarpdmap[i]),f)) |
| 15571 | { | ||
| 15572 | ✗ | return qe_invalid; | |
| 15573 | } | ||
| 15574 | 2505664 | } | |
| 15575 | } | ||
| 15576 | |||
| 15577 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_getc(&(temp_mapscr->tilewarpscr[0]),f)) |
| 15578 | { | ||
| 15579 | ✗ | return qe_invalid; | |
| 15580 | } | ||
| 15581 | |||
| 15582 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15583 | { | ||
| 15584 |
2/2✓ Branch 0 taken 1879248 times.
✓ Branch 1 taken 626416 times.
|
2505664 | for(int32_t i=1; i<4; i++) |
| 15585 | { | ||
| 15586 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1879248 times.
|
1879248 | if(!p_getc(&(temp_mapscr->tilewarpscr[i]),f)) |
| 15587 | { | ||
| 15588 | ✗ | return qe_invalid; | |
| 15589 | } | ||
| 15590 | 1879248 | } | |
| 15591 | 626416 | } | |
| 15592 | else | ||
| 15593 | { | ||
| 15594 | 528504 | temp_mapscr->tilewarpscr[1]=0; | |
| 15595 | 528504 | temp_mapscr->tilewarpscr[2]=0; | |
| 15596 | 528504 | temp_mapscr->tilewarpscr[3]=0; | |
| 15597 | } | ||
| 15598 | |||
| 15599 |
2/2✓ Branch 0 taken 626416 times.
✓ Branch 1 taken 528504 times.
|
1154920 | if(version >= 15) |
| 15600 | { | ||
| 15601 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 626416 times.
|
626416 | if(!p_getc(&(temp_mapscr->tilewarpoverlayflags),f)) |
| 15602 | { | ||
| 15603 | ✗ | return qe_invalid; | |
| 15604 | } | ||
| 15605 | 626416 | } | |
| 15606 | else | ||
| 15607 | { | ||
| 15608 | 528504 | temp_mapscr->tilewarpoverlayflags=0; | |
| 15609 | } | ||
| 15610 | |||
| 15611 |
1/2✓ Branch 0 taken 1154920 times.
✗ Branch 1 not taken.
|
1154920 | if(!p_getc(&(temp_mapscr->exitdir),f)) |
| 15612 | { | ||
| 15613 | ✗ | return qe_invalid; | |
| 15614 | } | ||
| 15615 | |||
| 15616 |
2/2✓ Branch 0 taken 1130024 times.
✓ Branch 1 taken 24896 times.
|
1154920 | if(Header->zelda_version < 0x193) |
| 15617 | { | ||
| 15618 |
1/2✓ Branch 0 taken 24896 times.
✗ Branch 1 not taken.
|
24896 | if(!p_getc(&tempbyte,f)) |
| 15619 | { | ||
| 15620 | ✗ | return qe_invalid; | |
| 15621 | } | ||
| 15622 | |||
| 15623 | 24896 | } | |
| 15624 | |||
| 15625 |
4/6✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1152200 times.
✓ Branch 2 taken 2720 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version == 0x192)&&(Header->build>145)&&(Header->build<154)) |
| 15626 | { | ||
| 15627 | ✗ | if(!p_getc(&padding,f)) | |
| 15628 | { | ||
| 15629 | ✗ | return qe_invalid; | |
| 15630 | } | ||
| 15631 | ✗ | } | |
| 15632 | |||
| 15633 |
2/2✓ Branch 0 taken 11549200 times.
✓ Branch 1 taken 1154920 times.
|
12704120 | for(int32_t k=0; k<10; k++) |
| 15634 | { | ||
| 15635 | /* | ||
| 15636 | if (!temp_mapscr->enemy[k]) | ||
| 15637 | { | ||
| 15638 | continue; | ||
| 15639 | } | ||
| 15640 | */ | ||
| 15641 |
5/6✓ Branch 0 taken 11327440 times.
✓ Branch 1 taken 221760 times.
✓ Branch 2 taken 27200 times.
✓ Branch 3 taken 11300240 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 27200 times.
|
11549200 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<10))) |
| 15642 | { | ||
| 15643 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 221760 times.
|
221760 | if(!p_getc(&tempbyte,f)) |
| 15644 | { | ||
| 15645 | ✗ | return qe_invalid; | |
| 15646 | } | ||
| 15647 | |||
| 15648 | 221760 | temp_mapscr->enemy[k]=tempbyte; | |
| 15649 | 221760 | } | |
| 15650 | else | ||
| 15651 | { | ||
| 15652 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11327440 times.
|
11327440 | if(!p_igetw(&(temp_mapscr->enemy[k]),f)) |
| 15653 | { | ||
| 15654 | ✗ | return qe_invalid; | |
| 15655 | } | ||
| 15656 | } | ||
| 15657 | |||
| 15658 |
5/6✓ Branch 0 taken 11327440 times.
✓ Branch 1 taken 221760 times.
✓ Branch 2 taken 27200 times.
✓ Branch 3 taken 11300240 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 27200 times.
|
11549200 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<108))) |
| 15659 | { | ||
| 15660 | //using enumerations here is dangerous | ||
| 15661 | //very easy to break old quests -DD | ||
| 15662 |
2/2✓ Branch 0 taken 1342 times.
✓ Branch 1 taken 220418 times.
|
221760 | if(temp_mapscr->enemy[k]>=57) //old eGOHMA1 |
| 15663 | { | ||
| 15664 | 1342 | temp_mapscr->enemy[k]+=5; | |
| 15665 | 1342 | } | |
| 15666 |
2/2✓ Branch 0 taken 220324 times.
✓ Branch 1 taken 94 times.
|
220418 | else if(temp_mapscr->enemy[k]>=52) //old eGLEEOK2 |
| 15667 | { | ||
| 15668 | 94 | temp_mapscr->enemy[k]+=1; | |
| 15669 | 94 | } | |
| 15670 | 221760 | } | |
| 15671 | |||
| 15672 |
2/2✓ Branch 0 taken 6264160 times.
✓ Branch 1 taken 5285040 times.
|
11549200 | if(version < 9) |
| 15673 | { | ||
| 15674 |
2/2✓ Branch 0 taken 5009135 times.
✓ Branch 1 taken 275905 times.
|
5285040 | if(temp_mapscr->enemy[k]>0) |
| 15675 | { | ||
| 15676 | 275905 | temp_mapscr->enemy[k]+=10; | |
| 15677 | 275905 | } | |
| 15678 | 5285040 | } | |
| 15679 | //don't read in any invalid data | ||
| 15680 |
2/2✓ Branch 0 taken 11548750 times.
✓ Branch 1 taken 450 times.
|
11549200 | if ( ((unsigned)temp_mapscr->enemy[k]) > MAXGUYS ) |
| 15681 | { | ||
| 15682 | 450 | al_trace("Tried to read an invalid enemy ID (%d) for tmpscr->enemy[%d]. This has been cleared to 0.\n", temp_mapscr->enemy[k], k); | |
| 15683 | 450 | temp_mapscr->enemy[k] = 0; | |
| 15684 | 450 | } | |
| 15685 | 11549200 | } | |
| 15686 | |||
| 15687 |
1/2✓ Branch 0 taken 1154920 times.
✗ Branch 1 not taken.
|
1154920 | if(!p_getc(&(temp_mapscr->pattern),f)) |
| 15688 | { | ||
| 15689 | ✗ | return qe_invalid; | |
| 15690 | } | ||
| 15691 | |||
| 15692 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_getc(&(temp_mapscr->sidewarptype[0]),f)) |
| 15693 | { | ||
| 15694 | ✗ | return qe_invalid; | |
| 15695 | } | ||
| 15696 | |||
| 15697 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15698 | { | ||
| 15699 |
2/2✓ Branch 0 taken 1879248 times.
✓ Branch 1 taken 626416 times.
|
2505664 | for(int32_t i=1; i<4; i++) |
| 15700 | { | ||
| 15701 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1879248 times.
|
1879248 | if(!p_getc(&(temp_mapscr->sidewarptype[i]),f)) |
| 15702 | { | ||
| 15703 | ✗ | return qe_invalid; | |
| 15704 | } | ||
| 15705 | 1879248 | } | |
| 15706 | 626416 | } | |
| 15707 | else | ||
| 15708 | { | ||
| 15709 | 528504 | temp_mapscr->sidewarptype[1]=0; | |
| 15710 | 528504 | temp_mapscr->sidewarptype[2]=0; | |
| 15711 | 528504 | temp_mapscr->sidewarptype[3]=0; | |
| 15712 | } | ||
| 15713 | |||
| 15714 |
2/2✓ Branch 0 taken 626416 times.
✓ Branch 1 taken 528504 times.
|
1154920 | if(version >= 15) |
| 15715 | { | ||
| 15716 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_getc(&(temp_mapscr->sidewarpoverlayflags),f)) |
| 15717 | { | ||
| 15718 | ✗ | return qe_invalid; | |
| 15719 | } | ||
| 15720 | 626416 | } | |
| 15721 | else | ||
| 15722 | { | ||
| 15723 | 528504 | temp_mapscr->sidewarpoverlayflags=0; | |
| 15724 | } | ||
| 15725 | |||
| 15726 |
1/2✓ Branch 0 taken 1154920 times.
✗ Branch 1 not taken.
|
1154920 | if(!p_getc(&(temp_mapscr->warparrivalx),f)) |
| 15727 | { | ||
| 15728 | ✗ | return qe_invalid; | |
| 15729 | } | ||
| 15730 | |||
| 15731 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_getc(&(temp_mapscr->warparrivaly),f)) |
| 15732 | { | ||
| 15733 | ✗ | return qe_invalid; | |
| 15734 | } | ||
| 15735 | |||
| 15736 |
2/2✓ Branch 0 taken 4619680 times.
✓ Branch 1 taken 1154920 times.
|
5774600 | for(int32_t k=0; k<4; k++) |
| 15737 | { | ||
| 15738 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4619680 times.
|
4619680 | if(!p_getc(&(temp_mapscr->path[k]),f)) |
| 15739 | { | ||
| 15740 | ✗ | return qe_invalid; | |
| 15741 | } | ||
| 15742 | 4619680 | } | |
| 15743 | |||
| 15744 |
1/2✓ Branch 0 taken 1154920 times.
✗ Branch 1 not taken.
|
1154920 | if(!p_getc(&(temp_mapscr->sidewarpscr[0]),f)) |
| 15745 | { | ||
| 15746 | ✗ | return qe_invalid; | |
| 15747 | } | ||
| 15748 | |||
| 15749 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15750 | { | ||
| 15751 |
2/2✓ Branch 0 taken 626416 times.
✓ Branch 1 taken 1879248 times.
|
2505664 | for(int32_t i=1; i<4; i++) |
| 15752 | { | ||
| 15753 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1879248 times.
|
1879248 | if(!p_getc(&(temp_mapscr->sidewarpscr[i]),f)) |
| 15754 | { | ||
| 15755 | ✗ | return qe_invalid; | |
| 15756 | } | ||
| 15757 | 1879248 | } | |
| 15758 | 626416 | } | |
| 15759 | else | ||
| 15760 | { | ||
| 15761 | 528504 | temp_mapscr->sidewarpscr[1]=0; | |
| 15762 | 528504 | temp_mapscr->sidewarpscr[2]=0; | |
| 15763 | 528504 | temp_mapscr->sidewarpscr[3]=0; | |
| 15764 | } | ||
| 15765 | |||
| 15766 |
2/2✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
|
1154920 | if(version <= 11) |
| 15767 | { | ||
| 15768 |
1/2✓ Branch 0 taken 528504 times.
✗ Branch 1 not taken.
|
528504 | if(!p_getc(&(tempbyte),f)) |
| 15769 | { | ||
| 15770 | ✗ | return qe_invalid; | |
| 15771 | } | ||
| 15772 | |||
| 15773 | 528504 | temp_mapscr->sidewarpdmap[0]=(word)tempbyte; | |
| 15774 | |||
| 15775 |
2/6✓ Branch 0 taken 528504 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
528504 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15776 | { | ||
| 15777 | ✗ | for(int32_t i=1; i<4; i++) | |
| 15778 | { | ||
| 15779 | ✗ | if(!p_getc(&(tempbyte),f)) | |
| 15780 | { | ||
| 15781 | ✗ | return qe_invalid; | |
| 15782 | } | ||
| 15783 | |||
| 15784 | ✗ | temp_mapscr->sidewarpdmap[i]=(word)tempbyte; | |
| 15785 | ✗ | } | |
| 15786 | ✗ | } | |
| 15787 | else | ||
| 15788 | { | ||
| 15789 | 528504 | temp_mapscr->sidewarpdmap[1]=0; | |
| 15790 | 528504 | temp_mapscr->sidewarpdmap[2]=0; | |
| 15791 | 528504 | temp_mapscr->sidewarpdmap[3]=0; | |
| 15792 | } | ||
| 15793 | 528504 | } | |
| 15794 | else | ||
| 15795 | { | ||
| 15796 |
2/2✓ Branch 0 taken 2505664 times.
✓ Branch 1 taken 626416 times.
|
3132080 | for(int32_t i=0; i<4; i++) |
| 15797 | { | ||
| 15798 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2505664 times.
|
2505664 | if(!p_igetw(&(temp_mapscr->sidewarpdmap[i]),f)) |
| 15799 | { | ||
| 15800 | ✗ | return qe_invalid; | |
| 15801 | } | ||
| 15802 | 2505664 | } | |
| 15803 | } | ||
| 15804 | |||
| 15805 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15806 | { | ||
| 15807 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_getc(&(temp_mapscr->sidewarpindex),f)) |
| 15808 | { | ||
| 15809 | ✗ | return qe_invalid; | |
| 15810 | } | ||
| 15811 | 626416 | } | |
| 15812 | 528504 | else temp_mapscr->sidewarpindex = 0; | |
| 15813 | |||
| 15814 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_igetw(&(temp_mapscr->undercombo),f)) |
| 15815 | { | ||
| 15816 | ✗ | return qe_invalid; | |
| 15817 | } | ||
| 15818 | |||
| 15819 |
2/2✓ Branch 0 taken 1130024 times.
✓ Branch 1 taken 24896 times.
|
1154920 | if(Header->zelda_version < 0x193) |
| 15820 | { | ||
| 15821 |
1/2✓ Branch 0 taken 24896 times.
✗ Branch 1 not taken.
|
24896 | if (!p_getc(&old_combo_pages[scrind], f)) |
| 15822 | { | ||
| 15823 | ✗ | return qe_invalid; | |
| 15824 | } | ||
| 15825 | 24896 | } | |
| 15826 | |||
| 15827 |
1/2✓ Branch 0 taken 1154920 times.
✗ Branch 1 not taken.
|
1154920 | if(!p_getc(&(temp_mapscr->undercset),f)) //recalculated for older quests |
| 15828 | { | ||
| 15829 | ✗ | return qe_invalid; | |
| 15830 | } | ||
| 15831 | |||
| 15832 |
1/2✓ Branch 0 taken 1154920 times.
✗ Branch 1 not taken.
|
1154920 | if(!p_igetw(&(temp_mapscr->catchall),f)) |
| 15833 | { | ||
| 15834 | ✗ | return qe_invalid; | |
| 15835 | } | ||
| 15836 | |||
| 15837 |
1/2✓ Branch 0 taken 1154920 times.
✗ Branch 1 not taken.
|
1154920 | if(!p_getc(&(temp_mapscr->flags),f)) |
| 15838 | { | ||
| 15839 | ✗ | return qe_invalid; | |
| 15840 | } | ||
| 15841 | |||
| 15842 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_getc(&(temp_mapscr->flags2),f)) |
| 15843 | { | ||
| 15844 | ✗ | return qe_invalid; | |
| 15845 | } | ||
| 15846 | |||
| 15847 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(!p_getc(&(temp_mapscr->flags3),f)) |
| 15848 | { | ||
| 15849 | ✗ | return qe_invalid; | |
| 15850 | } | ||
| 15851 | |||
| 15852 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>1))) |
| 15853 | //if (version>2) | ||
| 15854 | { | ||
| 15855 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_getc(&(temp_mapscr->flags4),f)) |
| 15856 | { | ||
| 15857 | ✗ | return qe_invalid; | |
| 15858 | } | ||
| 15859 | 626416 | } | |
| 15860 | |||
| 15861 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15862 | { | ||
| 15863 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 626416 times.
|
626416 | if(!p_getc(&(temp_mapscr->flags5),f)) |
| 15864 | { | ||
| 15865 | ✗ | return qe_invalid; | |
| 15866 | } | ||
| 15867 | |||
| 15868 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_igetw(&(temp_mapscr->noreset),f)) |
| 15869 | { | ||
| 15870 | ✗ | return qe_invalid; | |
| 15871 | } | ||
| 15872 | |||
| 15873 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_igetw(&(temp_mapscr->nocarry),f)) |
| 15874 | { | ||
| 15875 | ✗ | return qe_invalid; | |
| 15876 | } | ||
| 15877 | |||
| 15878 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 626416 times.
|
626416 | if(temp_mapscr->flags5&32) |
| 15879 | { | ||
| 15880 | ✗ | temp_mapscr->flags5 &= ~32; | |
| 15881 | ✗ | temp_mapscr->noreset |= 48; | |
| 15882 | ✗ | } | |
| 15883 | |||
| 15884 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 626416 times.
|
626416 | if(version<8) |
| 15885 | { | ||
| 15886 | ✗ | if(temp_mapscr->noreset&1) | |
| 15887 | { | ||
| 15888 | ✗ | temp_mapscr->noreset|=8192; | |
| 15889 | ✗ | } | |
| 15890 | |||
| 15891 | ✗ | if(temp_mapscr->nocarry&1) | |
| 15892 | { | ||
| 15893 | ✗ | temp_mapscr->nocarry|=8192; | |
| 15894 | ✗ | temp_mapscr->nocarry&=~1; | |
| 15895 | ✗ | } | |
| 15896 | ✗ | } | |
| 15897 | 626416 | } | |
| 15898 | else | ||
| 15899 | { | ||
| 15900 | 528504 | temp_mapscr->flags5 = 0; | |
| 15901 | 528504 | temp_mapscr->noreset = 0; | |
| 15902 | 528504 | temp_mapscr->nocarry = 0; | |
| 15903 | } | ||
| 15904 | |||
| 15905 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>9))) |
| 15906 | { | ||
| 15907 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 626416 times.
|
626416 | if(!p_getc(&(temp_mapscr->flags6),f)) |
| 15908 | { | ||
| 15909 | ✗ | return qe_invalid; | |
| 15910 | } | ||
| 15911 | 626416 | } | |
| 15912 | |||
| 15913 |
2/2✓ Branch 0 taken 626416 times.
✓ Branch 1 taken 528504 times.
|
1154920 | if(version>5) |
| 15914 | { | ||
| 15915 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_getc(&(temp_mapscr->flags7),f)) |
| 15916 | { | ||
| 15917 | ✗ | return qe_invalid; | |
| 15918 | } | ||
| 15919 | |||
| 15920 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_getc(&(temp_mapscr->flags8),f)) |
| 15921 | { | ||
| 15922 | ✗ | return qe_invalid; | |
| 15923 | } | ||
| 15924 | |||
| 15925 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 626416 times.
|
626416 | if(!p_getc(&(temp_mapscr->flags9),f)) |
| 15926 | { | ||
| 15927 | ✗ | return qe_invalid; | |
| 15928 | } | ||
| 15929 | |||
| 15930 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_getc(&(temp_mapscr->flags10),f)) |
| 15931 | { | ||
| 15932 | ✗ | return qe_invalid; | |
| 15933 | } | ||
| 15934 | |||
| 15935 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_getc(&(temp_mapscr->csensitive),f)) |
| 15936 | { | ||
| 15937 | ✗ | return qe_invalid; | |
| 15938 | } | ||
| 15939 | 626416 | } | |
| 15940 | else | ||
| 15941 | { | ||
| 15942 | 528504 | temp_mapscr->csensitive=1; | |
| 15943 | } | ||
| 15944 | |||
| 15945 |
2/2✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
|
1154920 | if(version<14) // August 2007: screen SFX added |
| 15946 | { | ||
| 15947 |
2/2✓ Branch 0 taken 527510 times.
✓ Branch 1 taken 994 times.
|
528504 | if(temp_mapscr->flags&8) //fROAR |
| 15948 | { | ||
| 15949 | 994 | temp_mapscr->bosssfx= | |
| 15950 |
2/2✓ Branch 0 taken 141 times.
✓ Branch 1 taken 853 times.
|
994 | (temp_mapscr->flags3&2) ? WAV_DODONGO : // fDODONGO |
| 15951 | 853 | (temp_mapscr->flags2&32) ? WAV_VADER : // fVADER | |
| 15952 | WAV_ROAR; | ||
| 15953 | 994 | } | |
| 15954 | |||
| 15955 |
2/2✓ Branch 0 taken 170 times.
✓ Branch 1 taken 528334 times.
|
528504 | if(temp_mapscr->flags&128) //fSEA |
| 15956 | { | ||
| 15957 | 170 | temp_mapscr->oceansfx=WAV_SEA; | |
| 15958 | 170 | } | |
| 15959 | |||
| 15960 | 528504 | temp_mapscr->secretsfx = (temp_mapscr->flags3&64) //fNOSECRETSOUND | |
| 15961 | ? 0 : WAV_SECRET; | ||
| 15962 | |||
| 15963 | 528504 | temp_mapscr->flags3 &= ~66; //64|2 | |
| 15964 | 528504 | temp_mapscr->flags2 &= ~32; | |
| 15965 | 528504 | temp_mapscr->flags &= ~136; // 128|8 | |
| 15966 | 528504 | } | |
| 15967 | else | ||
| 15968 | { | ||
| 15969 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 626416 times.
|
626416 | if(!p_getc(&(temp_mapscr->oceansfx),f)) |
| 15970 | { | ||
| 15971 | ✗ | return qe_invalid; | |
| 15972 | } | ||
| 15973 | |||
| 15974 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 626416 times.
|
626416 | if(!p_getc(&(temp_mapscr->bosssfx),f)) |
| 15975 | { | ||
| 15976 | ✗ | return qe_invalid; | |
| 15977 | } | ||
| 15978 | |||
| 15979 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_getc(&(temp_mapscr->secretsfx),f)) |
| 15980 | { | ||
| 15981 | ✗ | return qe_invalid; | |
| 15982 | } | ||
| 15983 | } | ||
| 15984 | |||
| 15985 |
2/2✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
|
1154920 | if(version<15) // October 2007: another SFX |
| 15986 | { | ||
| 15987 | 528504 | temp_mapscr->holdupsfx=WAV_PICKUP; | |
| 15988 | 528504 | } | |
| 15989 | else | ||
| 15990 | { | ||
| 15991 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_getc(&(temp_mapscr->holdupsfx),f)) |
| 15992 | { | ||
| 15993 | ✗ | return qe_invalid; | |
| 15994 | } | ||
| 15995 | } | ||
| 15996 | |||
| 15997 | |||
| 15998 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1130024 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>97))) |
| 15999 | { | ||
| 16000 |
2/2✓ Branch 0 taken 6796464 times.
✓ Branch 1 taken 1132744 times.
|
7929208 | for(int32_t k=0; k<6; k++) |
| 16001 | { | ||
| 16002 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6796464 times.
|
6796464 | if(!p_getc(&(temp_mapscr->layermap[k]),f)) |
| 16003 | { | ||
| 16004 | ✗ | return qe_invalid; | |
| 16005 | } | ||
| 16006 | 6796464 | } | |
| 16007 | |||
| 16008 |
2/2✓ Branch 0 taken 1132744 times.
✓ Branch 1 taken 6796464 times.
|
7929208 | for(int32_t k=0; k<6; k++) |
| 16009 | { | ||
| 16010 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6796464 times.
|
6796464 | if(!p_getc(&(temp_mapscr->layerscreen[k]),f)) |
| 16011 | { | ||
| 16012 | ✗ | return qe_invalid; | |
| 16013 | } | ||
| 16014 | 6796464 | } | |
| 16015 | 1132744 | } | |
| 16016 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 22176 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
22176 | else if((Header->zelda_version == 0x192)&&(Header->build>23)&&(Header->build<98)) |
| 16017 | { | ||
| 16018 | ✗ | if(!p_getc(&(temp_mapscr->layermap[2]),f)) | |
| 16019 | { | ||
| 16020 | ✗ | return qe_invalid; | |
| 16021 | } | ||
| 16022 | |||
| 16023 | ✗ | if(!p_getc(&(temp_mapscr->layerscreen[2]),f)) | |
| 16024 | { | ||
| 16025 | ✗ | return qe_invalid; | |
| 16026 | } | ||
| 16027 | |||
| 16028 | ✗ | if(!p_getc(&(temp_mapscr->layermap[4]),f)) | |
| 16029 | { | ||
| 16030 | ✗ | return qe_invalid; | |
| 16031 | } | ||
| 16032 | |||
| 16033 | ✗ | if(!p_getc(&(temp_mapscr->layerscreen[4]),f)) | |
| 16034 | |||
| 16035 | { | ||
| 16036 | ✗ | return qe_invalid; | |
| 16037 | } | ||
| 16038 | ✗ | } | |
| 16039 | |||
| 16040 |
3/4✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1152200 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2720 times.
|
1154920 | if((Header->zelda_version == 0x192)&&(Header->build>149)) |
| 16041 | { | ||
| 16042 |
2/2✓ Branch 0 taken 16320 times.
✓ Branch 1 taken 2720 times.
|
19040 | for(int32_t k=0; k<6; k++) |
| 16043 | { | ||
| 16044 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16320 times.
|
16320 | if(!p_getc(&tempbyte,f)) //layerxsize |
| 16045 | { | ||
| 16046 | ✗ | return qe_invalid; | |
| 16047 | } | ||
| 16048 | 16320 | } | |
| 16049 | |||
| 16050 |
2/2✓ Branch 0 taken 16320 times.
✓ Branch 1 taken 2720 times.
|
19040 | for(int32_t k=0; k<6; k++) |
| 16051 | { | ||
| 16052 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16320 times.
|
16320 | if(!p_getc(&tempbyte,f)) //layerxspeed |
| 16053 | { | ||
| 16054 | ✗ | return qe_invalid; | |
| 16055 | } | ||
| 16056 | 16320 | } | |
| 16057 | |||
| 16058 |
2/2✓ Branch 0 taken 16320 times.
✓ Branch 1 taken 2720 times.
|
19040 | for(int32_t k=0; k<6; k++) |
| 16059 | { | ||
| 16060 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16320 times.
|
16320 | if(!p_getc(&tempbyte,f)) //layerxdelay |
| 16061 | { | ||
| 16062 | ✗ | return qe_invalid; | |
| 16063 | } | ||
| 16064 | 16320 | } | |
| 16065 | |||
| 16066 |
2/2✓ Branch 0 taken 16320 times.
✓ Branch 1 taken 2720 times.
|
19040 | for(int32_t k=0; k<6; k++) |
| 16067 | { | ||
| 16068 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16320 times.
|
16320 | if(!p_getc(&tempbyte,f)) //layerysize |
| 16069 | { | ||
| 16070 | ✗ | return qe_invalid; | |
| 16071 | } | ||
| 16072 | 16320 | } | |
| 16073 | |||
| 16074 |
2/2✓ Branch 0 taken 16320 times.
✓ Branch 1 taken 2720 times.
|
19040 | for(int32_t k=0; k<6; k++) |
| 16075 | { | ||
| 16076 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16320 times.
|
16320 | if(!p_getc(&tempbyte,f)) //layeryspeed |
| 16077 | { | ||
| 16078 | ✗ | return qe_invalid; | |
| 16079 | } | ||
| 16080 | 16320 | } | |
| 16081 | |||
| 16082 |
2/2✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 16320 times.
|
19040 | for(int32_t k=0; k<6; k++) |
| 16083 | { | ||
| 16084 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16320 times.
|
16320 | if(!p_getc(&tempbyte,f)) //layerydelay |
| 16085 | { | ||
| 16086 | ✗ | return qe_invalid; | |
| 16087 | } | ||
| 16088 | 16320 | } | |
| 16089 | 2720 | } | |
| 16090 | |||
| 16091 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1130024 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>149))) |
| 16092 | { | ||
| 16093 |
2/2✓ Branch 0 taken 6796464 times.
✓ Branch 1 taken 1132744 times.
|
7929208 | for(int32_t k=0; k<6; k++) |
| 16094 | { | ||
| 16095 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6796464 times.
|
6796464 | if(!p_getc(&(temp_mapscr->layeropacity[k]),f)) |
| 16096 | { | ||
| 16097 | ✗ | return qe_invalid; | |
| 16098 | } | ||
| 16099 | 6796464 | } | |
| 16100 | 1132744 | } | |
| 16101 | |||
| 16102 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1130024 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>153))) |
| 16103 | { | ||
| 16104 |
3/4✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1130024 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2720 times.
|
1132744 | if((Header->zelda_version == 0x192)&&(Header->build>153)) |
| 16105 | { | ||
| 16106 |
1/2✓ Branch 0 taken 2720 times.
✗ Branch 1 not taken.
|
2720 | if(!p_getc(&padding,f)) |
| 16107 | { | ||
| 16108 | ✗ | return qe_invalid; | |
| 16109 | } | ||
| 16110 | 2720 | } | |
| 16111 | |||
| 16112 |
1/2✓ Branch 0 taken 1132744 times.
✗ Branch 1 not taken.
|
1132744 | if(!p_igetw(&(temp_mapscr->timedwarptics),f)) |
| 16113 | { | ||
| 16114 | ✗ | return qe_invalid; | |
| 16115 | } | ||
| 16116 | 1132744 | } | |
| 16117 | |||
| 16118 |
5/6✓ Branch 0 taken 1132744 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1130024 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1154920 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<24))) |
| 16119 | { | ||
| 16120 | 22176 | extras=15; | |
| 16121 | 22176 | } | |
| 16122 |
3/4✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1130024 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2720 times.
|
1132744 | else if(((Header->zelda_version == 0x192)&&(Header->build<98))) |
| 16123 | { | ||
| 16124 | ✗ | extras=11; | |
| 16125 | ✗ | } | |
| 16126 |
3/4✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1130024 times.
✓ Branch 2 taken 2720 times.
✗ Branch 3 not taken.
|
1132744 | else if((Header->zelda_version == 0x192)&&(Header->build<150)) |
| 16127 | { | ||
| 16128 | ✗ | extras=32; | |
| 16129 | ✗ | } | |
| 16130 |
3/4✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1130024 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2720 times.
|
1132744 | else if((Header->zelda_version == 0x192)&&(Header->build<154)) |
| 16131 | { | ||
| 16132 | ✗ | extras=64; | |
| 16133 | ✗ | } | |
| 16134 |
2/2✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1130024 times.
|
1132744 | else if(Header->zelda_version < 0x193) |
| 16135 | { | ||
| 16136 | 2720 | extras=62; | |
| 16137 | 2720 | } | |
| 16138 | else | ||
| 16139 | |||
| 16140 | { | ||
| 16141 | 1130024 | extras=0; | |
| 16142 | } | ||
| 16143 | |||
| 16144 |
2/2✓ Branch 0 taken 501280 times.
✓ Branch 1 taken 1154920 times.
|
1656200 | for(int32_t k=0; k<extras; k++) |
| 16145 | { | ||
| 16146 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 501280 times.
|
501280 | if(!p_getc(&tempbyte,f)) //extra[k] |
| 16147 | { | ||
| 16148 | ✗ | return qe_invalid; | |
| 16149 | } | ||
| 16150 | 501280 | } | |
| 16151 | |||
| 16152 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>2))) |
| 16153 | //if (version>3) | ||
| 16154 | { | ||
| 16155 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 626416 times.
|
626416 | if(!p_getc(&(temp_mapscr->nextmap),f)) |
| 16156 | { | ||
| 16157 | ✗ | return qe_invalid; | |
| 16158 | } | ||
| 16159 | |||
| 16160 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_getc(&(temp_mapscr->nextscr),f)) |
| 16161 | { | ||
| 16162 | ✗ | return qe_invalid; | |
| 16163 | } | ||
| 16164 | 626416 | } | |
| 16165 | else | ||
| 16166 | { | ||
| 16167 | 528504 | temp_mapscr->nextmap=0; | |
| 16168 | 528504 | temp_mapscr->nextscr=0; | |
| 16169 | } | ||
| 16170 | |||
| 16171 |
5/6✓ Branch 0 taken 1132744 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1130024 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1154920 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<137))) |
| 16172 | { | ||
| 16173 | 22176 | secretcombos=20; | |
| 16174 | 22176 | } | |
| 16175 |
3/4✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1130024 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2720 times.
|
1132744 | else if((Header->zelda_version == 0x192)&&(Header->build<154)) |
| 16176 | { | ||
| 16177 | ✗ | secretcombos=256; | |
| 16178 | ✗ | } | |
| 16179 | else | ||
| 16180 | { | ||
| 16181 | 1132744 | secretcombos=128; | |
| 16182 | } | ||
| 16183 | |||
| 16184 |
5/6✓ Branch 0 taken 1132744 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1130024 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1154920 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<154))) |
| 16185 | { | ||
| 16186 |
2/2✓ Branch 0 taken 443520 times.
✓ Branch 1 taken 22176 times.
|
465696 | for(int32_t k=0; k<secretcombos; k++) |
| 16187 | { | ||
| 16188 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 443520 times.
|
443520 | if(!p_getc(&tempbyte,f)) |
| 16189 | { | ||
| 16190 | ✗ | return qe_invalid; | |
| 16191 | } | ||
| 16192 | |||
| 16193 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 443520 times.
|
443520 | if(k<128) |
| 16194 | { | ||
| 16195 | 443520 | temp_mapscr->secretcombo[k]=tempbyte; | |
| 16196 | 443520 | } | |
| 16197 | 443520 | } | |
| 16198 | 22176 | } | |
| 16199 | else | ||
| 16200 | { | ||
| 16201 |
2/2✓ Branch 0 taken 144991232 times.
✓ Branch 1 taken 1132744 times.
|
146123976 | for(int32_t k=0; k<128; k++) |
| 16202 | { | ||
| 16203 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 144991232 times.
|
144991232 | if(!p_igetw(&(temp_mapscr->secretcombo[k]),f)) |
| 16204 | { | ||
| 16205 | ✗ | return qe_invalid; | |
| 16206 | } | ||
| 16207 | |||
| 16208 | 144991232 | } | |
| 16209 | } | ||
| 16210 | |||
| 16211 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1130024 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>153))) |
| 16212 | { | ||
| 16213 |
2/2✓ Branch 0 taken 144991232 times.
✓ Branch 1 taken 1132744 times.
|
146123976 | for(int32_t k=0; k<128; k++) |
| 16214 | { | ||
| 16215 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 144991232 times.
|
144991232 | if(!p_getc(&(temp_mapscr->secretcset[k]),f)) |
| 16216 | { | ||
| 16217 | ✗ | return qe_invalid; | |
| 16218 | } | ||
| 16219 | 144991232 | } | |
| 16220 | |||
| 16221 |
2/2✓ Branch 0 taken 144991232 times.
✓ Branch 1 taken 1132744 times.
|
146123976 | for(int32_t k=0; k<128; k++) |
| 16222 | { | ||
| 16223 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 144991232 times.
|
144991232 | if(!p_getc(&(temp_mapscr->secretflag[k]),f)) |
| 16224 | { | ||
| 16225 | ✗ | return qe_invalid; | |
| 16226 | } | ||
| 16227 | 144991232 | } | |
| 16228 | 1132744 | } | |
| 16229 | |||
| 16230 |
4/6✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1152200 times.
✓ Branch 2 taken 2720 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version == 0x192)&&(Header->build>97)&&(Header->build<154)) |
| 16231 | { | ||
| 16232 | ✗ | if(!p_getc(&padding,f)) | |
| 16233 | { | ||
| 16234 | ✗ | return qe_invalid; | |
| 16235 | } | ||
| 16236 | ✗ | } | |
| 16237 | |||
| 16238 |
2/2✓ Branch 0 taken 203265920 times.
✓ Branch 1 taken 1154920 times.
|
204420840 | for(int32_t k=0; k<176; k++) |
| 16239 | { | ||
| 16240 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 203265920 times.
|
203265920 | if(!p_igetw(&(temp_mapscr->data[k]),f)) |
| 16241 | { | ||
| 16242 | ✗ | return qe_invalid; | |
| 16243 | } | ||
| 16244 | 203265920 | } | |
| 16245 | |||
| 16246 |
4/6✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1152200 times.
✓ Branch 2 taken 2720 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version == 0x192)&&(Header->build>20)&&(Header->build<24)) |
| 16247 | { | ||
| 16248 | ✗ | if(!p_getc(&padding,f)) | |
| 16249 | { | ||
| 16250 | ✗ | return qe_invalid; | |
| 16251 | } | ||
| 16252 | |||
| 16253 | ✗ | if(!p_getc(&padding,f)) | |
| 16254 | { | ||
| 16255 | ✗ | return qe_invalid; | |
| 16256 | } | ||
| 16257 | ✗ | } | |
| 16258 | |||
| 16259 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1130024 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>20))) |
| 16260 | { | ||
| 16261 |
2/2✓ Branch 0 taken 199362944 times.
✓ Branch 1 taken 1132744 times.
|
200495688 | for(int32_t k=0; k<176; k++) |
| 16262 | { | ||
| 16263 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 199362944 times.
|
199362944 | if(!p_getc(&(temp_mapscr->sflag[k]),f)) |
| 16264 | { | ||
| 16265 | ✗ | return qe_invalid; | |
| 16266 | } | ||
| 16267 | |||
| 16268 |
3/4✓ Branch 0 taken 478720 times.
✓ Branch 1 taken 198884224 times.
✓ Branch 2 taken 478720 times.
✗ Branch 3 not taken.
|
199362944 | if((Header->zelda_version == 0x192)&&(Header->build<24)) |
| 16269 | { | ||
| 16270 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 16271 | { | ||
| 16272 | ✗ | return qe_invalid; | |
| 16273 | } | ||
| 16274 | |||
| 16275 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 16276 | { | ||
| 16277 | ✗ | return qe_invalid; | |
| 16278 | } | ||
| 16279 | |||
| 16280 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 16281 | { | ||
| 16282 | ✗ | return qe_invalid; | |
| 16283 | } | ||
| 16284 | ✗ | } | |
| 16285 | 199362944 | } | |
| 16286 | 1132744 | } | |
| 16287 | |||
| 16288 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1130024 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1154920 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>97))) |
| 16289 | { | ||
| 16290 |
2/2✓ Branch 0 taken 1132744 times.
✓ Branch 1 taken 199362944 times.
|
200495688 | for(int32_t k=0; k<176; k++) |
| 16291 | { | ||
| 16292 | |||
| 16293 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 199362944 times.
|
199362944 | if(!p_getc(&(temp_mapscr->cset[k]),f)) |
| 16294 | { | ||
| 16295 | ✗ | return qe_invalid; | |
| 16296 | } | ||
| 16297 | 199362944 | } | |
| 16298 | 1132744 | } | |
| 16299 | |||
| 16300 |
5/6✓ Branch 0 taken 1132744 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1130024 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1154920 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<154))) |
| 16301 | { | ||
| 16302 | 22176 | temp_mapscr->undercset=(temp_mapscr->undercombo>>8)&7; | |
| 16303 | 22176 | temp_mapscr->undercombo=(temp_mapscr->undercombo&0xFF)+(old_combo_pages[scrind]<<8); | |
| 16304 | 22176 | } | |
| 16305 | |||
| 16306 |
5/6✓ Branch 0 taken 1132744 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1130024 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1154920 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<137))) |
| 16307 | { | ||
| 16308 | 22176 | temp_mapscr->secretcombo[sSBOMB]=temp_mapscr->secretcombo[sBOMB]; | |
| 16309 | 22176 | temp_mapscr->secretcombo[sRCANDLE]=temp_mapscr->secretcombo[sBCANDLE]; | |
| 16310 | 22176 | temp_mapscr->secretcombo[sWANDFIRE]=temp_mapscr->secretcombo[sBCANDLE]; | |
| 16311 | 22176 | temp_mapscr->secretcombo[sDIVINEFIRE]=temp_mapscr->secretcombo[sBCANDLE]; | |
| 16312 | 22176 | temp_mapscr->secretcombo[sSARROW]=temp_mapscr->secretcombo[sARROW]; | |
| 16313 | 22176 | temp_mapscr->secretcombo[sGARROW]=temp_mapscr->secretcombo[sARROW]; | |
| 16314 | 22176 | } | |
| 16315 | |||
| 16316 |
5/6✓ Branch 0 taken 1132744 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1130024 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1154920 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<154))) |
| 16317 | { | ||
| 16318 |
2/2✓ Branch 0 taken 3902976 times.
✓ Branch 1 taken 22176 times.
|
3925152 | for(int32_t k=0; k<176; k++) |
| 16319 | { | ||
| 16320 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 3902976 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
3902976 | if((Header->zelda_version == 0x192)&&(Header->build>149)) |
| 16321 | { | ||
| 16322 | ✗ | if((Header->zelda_version == 0x192)&&(Header->build!=153)) | |
| 16323 | { | ||
| 16324 | ✗ | temp_mapscr->cset[k]=((temp_mapscr->data[k]>>8)&7); | |
| 16325 | ✗ | } | |
| 16326 | ✗ | } | |
| 16327 | else | ||
| 16328 | { | ||
| 16329 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 3902976 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
3902976 | if((Header->zelda_version < 0x192)|| |
| 16330 | ✗ | ((Header->zelda_version == 0x192)&&(Header->build<21))) | |
| 16331 | { | ||
| 16332 | 3902976 | temp_mapscr->sflag[k]=(temp_mapscr->data[k]>>11); | |
| 16333 | 3902976 | } | |
| 16334 | |||
| 16335 | 3902976 | temp_mapscr->cset[k]=((temp_mapscr->data[k]>>8)&7); | |
| 16336 | } | ||
| 16337 | |||
| 16338 | 3902976 | temp_mapscr->data[k]=(temp_mapscr->data[k]&0xFF)+(old_combo_pages[scrind]<<8); | |
| 16339 | 3902976 | } | |
| 16340 | 22176 | } | |
| 16341 | |||
| 16342 | /*if(version>12) | ||
| 16343 | { | ||
| 16344 | if(!p_getc(&(temp_mapscr->scrWidth),f)) | ||
| 16345 | { | ||
| 16346 | return qe_invalid; | ||
| 16347 | } | ||
| 16348 | if(!p_getc(&(temp_mapscr->scrHeight),f)) | ||
| 16349 | { | ||
| 16350 | return qe_invalid; | ||
| 16351 | } | ||
| 16352 | }*/ | ||
| 16353 | |||
| 16354 |
2/2✓ Branch 0 taken 626416 times.
✓ Branch 1 taken 528504 times.
|
1154920 | if(version>4) |
| 16355 | { | ||
| 16356 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_igetw(&(temp_mapscr->screen_midi),f)) |
| 16357 | { | ||
| 16358 | ✗ | return qe_invalid; | |
| 16359 | } | ||
| 16360 | 626416 | } | |
| 16361 | else | ||
| 16362 | { | ||
| 16363 | 528504 | temp_mapscr->screen_midi = -1; | |
| 16364 | } | ||
| 16365 | |||
| 16366 |
2/2✓ Branch 0 taken 626416 times.
✓ Branch 1 taken 528504 times.
|
1154920 | if(version>=17) |
| 16367 | { | ||
| 16368 |
1/2✓ Branch 0 taken 626416 times.
✗ Branch 1 not taken.
|
626416 | if(!p_getc(&(temp_mapscr->lens_layer),f)) |
| 16369 | { | ||
| 16370 | ✗ | return qe_invalid; | |
| 16371 | } | ||
| 16372 | 626416 | } | |
| 16373 | else | ||
| 16374 | { | ||
| 16375 | 528504 | temp_mapscr->lens_layer = llNORMAL; | |
| 16376 | } | ||
| 16377 | |||
| 16378 |
2/2✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 626416 times.
|
1154920 | if(version>6) |
| 16379 | { | ||
| 16380 | dword bits; | ||
| 16381 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 626416 times.
|
626416 | if(!p_igetl(&bits,f)) |
| 16382 | { | ||
| 16383 | ✗ | return qe_invalid; | |
| 16384 | } | ||
| 16385 | |||
| 16386 | int32_t m; | ||
| 16387 | float tempfloat; | ||
| 16388 | word tempw; | ||
| 16389 | 626416 | temp_mapscr->ffcCountMarkDirty(); | |
| 16390 | 626416 | temp_mapscr->ffcs.clear(); | |
| 16391 | 626416 | temp_mapscr->ffcs.resize(32); | |
| 16392 |
2/2✓ Branch 0 taken 626416 times.
✓ Branch 1 taken 20045312 times.
|
20671728 | for(m=0; m<32; m++) |
| 16393 | { | ||
| 16394 | 20045312 | ffcdata& tempffc = temp_mapscr->ffcs[m]; | |
| 16395 |
2/2✓ Branch 0 taken 19785588 times.
✓ Branch 1 taken 259724 times.
|
20045312 | if((bits>>m)&1) |
| 16396 | { | ||
| 16397 |
1/2✓ Branch 0 taken 259724 times.
✗ Branch 1 not taken.
|
259724 | if(!p_igetw(&tempw,f)) |
| 16398 | { | ||
| 16399 | ✗ | return qe_invalid; | |
| 16400 | } | ||
| 16401 | 259724 | tempffc.data = tempw; | |
| 16402 | |||
| 16403 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_getc(&(tempffc.cset),f)) |
| 16404 | { | ||
| 16405 | ✗ | return qe_invalid; | |
| 16406 | } | ||
| 16407 | |||
| 16408 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetw(&(tempffc.delay),f)) |
| 16409 | { | ||
| 16410 | ✗ | return qe_invalid; | |
| 16411 | } | ||
| 16412 | |||
| 16413 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(version < 9) |
| 16414 | { | ||
| 16415 | ✗ | if(!p_igetf_DO_NOT_USE(&tempfloat,f)) | |
| 16416 | { | ||
| 16417 | ✗ | return qe_invalid; | |
| 16418 | } | ||
| 16419 | |||
| 16420 | ✗ | tempffc.x=zslongToFix(int32_t(tempfloat*10000)); | |
| 16421 | |||
| 16422 | ✗ | if(!p_igetf_DO_NOT_USE(&tempfloat,f)) | |
| 16423 | { | ||
| 16424 | ✗ | return qe_invalid; | |
| 16425 | } | ||
| 16426 | |||
| 16427 | ✗ | tempffc.y=zslongToFix(int32_t(tempfloat*10000)); | |
| 16428 | |||
| 16429 | ✗ | if(!p_igetf_DO_NOT_USE(&tempfloat,f)) | |
| 16430 | { | ||
| 16431 | ✗ | return qe_invalid; | |
| 16432 | } | ||
| 16433 | |||
| 16434 | ✗ | tempffc.vx=zslongToFix(int32_t(tempfloat*10000)); | |
| 16435 | |||
| 16436 | ✗ | if(!p_igetf_DO_NOT_USE(&tempfloat,f)) | |
| 16437 | { | ||
| 16438 | ✗ | return qe_invalid; | |
| 16439 | } | ||
| 16440 | |||
| 16441 | ✗ | tempffc.vy=zslongToFix(int32_t(tempfloat*10000)); | |
| 16442 | |||
| 16443 | ✗ | if(!p_igetf_DO_NOT_USE(&tempfloat,f)) | |
| 16444 | { | ||
| 16445 | ✗ | return qe_invalid; | |
| 16446 | } | ||
| 16447 | |||
| 16448 | ✗ | tempffc.ax=zslongToFix(int32_t(tempfloat*10000)); | |
| 16449 | |||
| 16450 | ✗ | if(!p_igetf_DO_NOT_USE(&tempfloat,f)) | |
| 16451 | { | ||
| 16452 | ✗ | return qe_invalid; | |
| 16453 | } | ||
| 16454 | |||
| 16455 | ✗ | tempffc.ay=zslongToFix(int32_t(tempfloat*10000)); | |
| 16456 | ✗ | } | |
| 16457 | else | ||
| 16458 | { | ||
| 16459 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetzf(&(tempffc.x),f)) |
| 16460 | { | ||
| 16461 | ✗ | return qe_invalid; | |
| 16462 | } | ||
| 16463 | |||
| 16464 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetzf(&(tempffc.y),f)) |
| 16465 | { | ||
| 16466 | ✗ | return qe_invalid; | |
| 16467 | } | ||
| 16468 | |||
| 16469 |
1/2✓ Branch 0 taken 259724 times.
✗ Branch 1 not taken.
|
259724 | if(!p_igetzf(&(tempffc.vx),f)) |
| 16470 | { | ||
| 16471 | ✗ | return qe_invalid; | |
| 16472 | } | ||
| 16473 | |||
| 16474 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetzf(&(tempffc.vy),f)) |
| 16475 | { | ||
| 16476 | ✗ | return qe_invalid; | |
| 16477 | } | ||
| 16478 | |||
| 16479 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetzf(&(tempffc.ax),f)) |
| 16480 | { | ||
| 16481 | ✗ | return qe_invalid; | |
| 16482 | } | ||
| 16483 | |||
| 16484 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetzf(&(tempffc.ay),f)) |
| 16485 | { | ||
| 16486 | ✗ | return qe_invalid; | |
| 16487 | } | ||
| 16488 | } | ||
| 16489 | |||
| 16490 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_getc(&(tempffc.link),f)) |
| 16491 | { | ||
| 16492 | ✗ | return qe_invalid; | |
| 16493 | } | ||
| 16494 | |||
| 16495 |
1/2✓ Branch 0 taken 259724 times.
✗ Branch 1 not taken.
|
259724 | if(version>7) |
| 16496 | { | ||
| 16497 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_getc(&tempbyte,f)) |
| 16498 | { | ||
| 16499 | ✗ | return qe_invalid; | |
| 16500 | } | ||
| 16501 | |||
| 16502 | 259724 | tempffc.hit_width = (tempbyte&0x3F)+1; | |
| 16503 | 259724 | tempffc.txsz = (tempbyte>>6)+1; | |
| 16504 | |||
| 16505 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_getc(&tempbyte,f)) |
| 16506 | { | ||
| 16507 | ✗ | return qe_invalid; | |
| 16508 | } | ||
| 16509 | |||
| 16510 | 259724 | tempffc.hit_height = (tempbyte&0x3F)+1; | |
| 16511 | 259724 | tempffc.tysz = (tempbyte>>6)+1; | |
| 16512 | |||
| 16513 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetl(&(tempffc.flags),f)) |
| 16514 | { | ||
| 16515 | ✗ | return qe_invalid; | |
| 16516 | } | ||
| 16517 | 259724 | } | |
| 16518 | else | ||
| 16519 | { | ||
| 16520 | ✗ | tempffc.hit_width=16; | |
| 16521 | ✗ | tempffc.hit_height=16; | |
| 16522 | ✗ | tempffc.txsz=1; | |
| 16523 | ✗ | tempffc.tysz=1; | |
| 16524 | ✗ | tempffc.flags=ffc_none; | |
| 16525 | } | ||
| 16526 | |||
| 16527 | 259724 | tempffc.updateSolid(); | |
| 16528 | |||
| 16529 | |||
| 16530 |
4/6✓ Branch 0 taken 259724 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 253720 times.
✓ Branch 3 taken 6004 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 253720 times.
|
259724 | if(Header->zelda_version == 0x211 || (Header->zelda_version == 0x250 && Header->build<20)) |
| 16531 | { | ||
| 16532 | ✗ | tempffc.flags|=ffc_ignoreholdup; | |
| 16533 | ✗ | } | |
| 16534 | |||
| 16535 |
1/2✓ Branch 0 taken 259724 times.
✗ Branch 1 not taken.
|
259724 | if(version>9) |
| 16536 | { | ||
| 16537 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetw(&(tempffc.script),f)) |
| 16538 | { | ||
| 16539 | ✗ | return qe_invalid; | |
| 16540 | } | ||
| 16541 | 259724 | } | |
| 16542 | else | ||
| 16543 | { | ||
| 16544 | ✗ | tempffc.script=0; | |
| 16545 | } | ||
| 16546 | |||
| 16547 |
1/2✓ Branch 0 taken 259724 times.
✗ Branch 1 not taken.
|
259724 | if(version>10) |
| 16548 | { | ||
| 16549 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetl(&(tempffc.initd[0]),f)) |
| 16550 | { | ||
| 16551 | ✗ | return qe_invalid; | |
| 16552 | } | ||
| 16553 | |||
| 16554 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetl(&(tempffc.initd[1]),f)) |
| 16555 | { | ||
| 16556 | ✗ | return qe_invalid; | |
| 16557 | } | ||
| 16558 | |||
| 16559 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetl(&(tempffc.initd[2]),f)) |
| 16560 | { | ||
| 16561 | ✗ | return qe_invalid; | |
| 16562 | } | ||
| 16563 | |||
| 16564 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetl(&(tempffc.initd[3]),f)) |
| 16565 | { | ||
| 16566 | ✗ | return qe_invalid; | |
| 16567 | } | ||
| 16568 | |||
| 16569 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetl(&(tempffc.initd[4]),f)) |
| 16570 | { | ||
| 16571 | ✗ | return qe_invalid; | |
| 16572 | } | ||
| 16573 | |||
| 16574 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetl(&(tempffc.initd[5]),f)) |
| 16575 | { | ||
| 16576 | ✗ | return qe_invalid; | |
| 16577 | } | ||
| 16578 | |||
| 16579 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetl(&(tempffc.initd[6]),f)) |
| 16580 | { | ||
| 16581 | ✗ | return qe_invalid; | |
| 16582 | } | ||
| 16583 | |||
| 16584 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_igetl(&(tempffc.initd[7]),f)) |
| 16585 | { | ||
| 16586 | ✗ | return qe_invalid; | |
| 16587 | } | ||
| 16588 | |||
| 16589 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_getc(&(tempbyte),f)) |
| 16590 | { | ||
| 16591 | ✗ | return qe_invalid; | |
| 16592 | } | ||
| 16593 | |||
| 16594 | 259724 | tempffc.inita[0]=tempbyte*10000; | |
| 16595 | |||
| 16596 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 259724 times.
|
259724 | if(!p_getc(&(tempbyte),f)) |
| 16597 | { | ||
| 16598 | ✗ | return qe_invalid; | |
| 16599 | } | ||
| 16600 | |||
| 16601 | 259724 | tempffc.inita[1]=tempbyte*10000; | |
| 16602 | 259724 | } | |
| 16603 | else | ||
| 16604 | { | ||
| 16605 | ✗ | tempffc.inita[0] = 10000; | |
| 16606 | ✗ | tempffc.inita[1] = 10000; | |
| 16607 | } | ||
| 16608 | |||
| 16609 |
1/2✓ Branch 0 taken 259724 times.
✗ Branch 1 not taken.
|
259724 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 16610 | { | ||
| 16611 | ✗ | tempffc.script = 0; | |
| 16612 | ✗ | for(int q = 0; q < 8; ++q) | |
| 16613 | ✗ | tempffc.initd[q] = 0; | |
| 16614 | ✗ | } | |
| 16615 |
1/2✓ Branch 0 taken 259724 times.
✗ Branch 1 not taken.
|
259724 | if(version <= 11) |
| 16616 | { | ||
| 16617 | ✗ | fixffcs=true; | |
| 16618 | ✗ | } | |
| 16619 | 259724 | } | |
| 16620 | 20045312 | } | |
| 16621 | 626416 | } | |
| 16622 | |||
| 16623 | 1154920 | temp_mapscr->ffcCountMarkDirty(); | |
| 16624 | 1154920 | temp_mapscr->ffcs.resize(temp_mapscr->numFFC()); | |
| 16625 | 1154920 | temp_mapscr->ffcs.shrink_to_fit(); | |
| 16626 | |||
| 16627 | //add in the new whistle flags | ||
| 16628 |
2/2✓ Branch 0 taken 626416 times.
✓ Branch 1 taken 528504 times.
|
1154920 | if(version<13) |
| 16629 | { | ||
| 16630 |
2/2✓ Branch 0 taken 124 times.
✓ Branch 1 taken 528380 times.
|
528504 | if(temp_mapscr->flags & fWHISTLE) |
| 16631 | { | ||
| 16632 | 124 | temp_mapscr->flags7 |= (fWHISTLEPAL | fWHISTLEWATER); | |
| 16633 | 124 | } | |
| 16634 | 528504 | } | |
| 16635 | |||
| 16636 | //2.55 starts here | ||
| 16637 |
3/4✓ Branch 0 taken 34408 times.
✓ Branch 1 taken 1120512 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 34408 times.
|
1154920 | if ( version >= 19 && Header->zelda_version > 0x253 ) |
| 16638 | { | ||
| 16639 | // mapscr fields that were never used, so are now removed: | ||
| 16640 | // int32_t npcstrings[10]; | ||
| 16641 | // int16_t new_items[10]; | ||
| 16642 | // int16_t new_item_x[10]; | ||
| 16643 | // int16_t new_item_y[10]; | ||
| 16644 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 34408 times.
|
34408 | if (pack_fseek(f, 100)) |
| 16645 | { | ||
| 16646 | ✗ | return qe_invalid; | |
| 16647 | } | ||
| 16648 | 34408 | } | |
| 16649 | |||
| 16650 |
3/4✓ Branch 0 taken 34408 times.
✓ Branch 1 taken 1120512 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 34408 times.
|
1154920 | if ( version >= 20 && Header->zelda_version > 0x253 ) |
| 16651 | { | ||
| 16652 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 34408 times.
|
34408 | if(!p_igetw(&(temp_mapscr->script),f)) |
| 16653 | { | ||
| 16654 | ✗ | return qe_invalid; | |
| 16655 | } | ||
| 16656 |
2/2✓ Branch 0 taken 275264 times.
✓ Branch 1 taken 34408 times.
|
309672 | for ( int32_t q = 0; q < 8; q++) |
| 16657 | { | ||
| 16658 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 275264 times.
|
275264 | if(!p_igetl(&(temp_mapscr->screeninitd[q]),f)) |
| 16659 | { | ||
| 16660 | ✗ | return qe_invalid; | |
| 16661 | } | ||
| 16662 | 275264 | } | |
| 16663 | 34408 | } | |
| 16664 |
2/2✓ Branch 0 taken 1120512 times.
✓ Branch 1 taken 34408 times.
|
1154920 | if ( version < 20 ) |
| 16665 | { | ||
| 16666 | 1120512 | temp_mapscr->script = 0; | |
| 16667 |
2/2✓ Branch 0 taken 8964096 times.
✓ Branch 1 taken 1120512 times.
|
10084608 | for ( int32_t q = 0; q < 8; q++) temp_mapscr->screeninitd[q] = 0; |
| 16668 | 1120512 | } | |
| 16669 |
3/4✓ Branch 0 taken 34408 times.
✓ Branch 1 taken 1120512 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 34408 times.
|
1154920 | if ( version >= 21 && Header->zelda_version > 0x253 ) |
| 16670 | { | ||
| 16671 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 34408 times.
|
34408 | if(!p_getc(&(temp_mapscr->preloadscript),f)) |
| 16672 | { | ||
| 16673 | ✗ | return qe_invalid; | |
| 16674 | } | ||
| 16675 | 34408 | } | |
| 16676 |
2/2✓ Branch 0 taken 34408 times.
✓ Branch 1 taken 1120512 times.
|
1154920 | if ( version < 21 ) |
| 16677 | { | ||
| 16678 | 1120512 | temp_mapscr->preloadscript = 0; | |
| 16679 | 1120512 | } | |
| 16680 | //all builds with version > 20 need this. -Z | ||
| 16681 | |||
| 16682 |
3/4✓ Branch 0 taken 34408 times.
✓ Branch 1 taken 1120512 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 34408 times.
|
1154920 | if ( version >= 22 && Header->zelda_version > 0x253 ) //26th June, 2019; Layer Visibility |
| 16683 | { | ||
| 16684 |
1/2✓ Branch 0 taken 34408 times.
✗ Branch 1 not taken.
|
34408 | if(!p_getc(&(temp_mapscr->hidelayers ),f)) |
| 16685 | { | ||
| 16686 | ✗ | return qe_invalid; | |
| 16687 | } | ||
| 16688 |
1/2✓ Branch 0 taken 34408 times.
✗ Branch 1 not taken.
|
34408 | if(!p_getc(&(temp_mapscr->hidescriptlayers ),f)) |
| 16689 | { | ||
| 16690 | ✗ | return qe_invalid; | |
| 16691 | } | ||
| 16692 | 34408 | } | |
| 16693 |
2/2✓ Branch 0 taken 34408 times.
✓ Branch 1 taken 1120512 times.
|
1154920 | if ( version < 22 ) |
| 16694 | { | ||
| 16695 | 1120512 | temp_mapscr->hidelayers = 0; | |
| 16696 | 1120512 | temp_mapscr->hidescriptlayers = 0; | |
| 16697 | 1120512 | } | |
| 16698 | |||
| 16699 | //Dodongos in 2.10 used the boss roar, not the dodongo sound. -Z | ||
| 16700 | //May be any version before 2.11. -Z | ||
| 16701 | /* --not the roar, the HIT SFX | ||
| 16702 | if ( Header->zelda_version <= 0x210 ) | ||
| 16703 | { | ||
| 16704 | if ( temp_mapscr->bosssfx == WAV_DODONGO ) | ||
| 16705 | { | ||
| 16706 | temp_mapscr->bosssfx = WAV_ROAR; | ||
| 16707 | } | ||
| 16708 | } | ||
| 16709 | */ | ||
| 16710 |
2/2✓ Branch 0 taken 4619680 times.
✓ Branch 1 taken 1154920 times.
|
5774600 | for(int32_t k=0; k<4; k++) |
| 16711 | { | ||
| 16712 |
1/2✓ Branch 0 taken 4619680 times.
✗ Branch 1 not taken.
|
4619680 | if(temp_mapscr->door[k] == dNONE) |
| 16713 | ✗ | temp_mapscr->door[k] = dWALL; | |
| 16714 | 4619680 | } | |
| 16715 | |||
| 16716 | 1154920 | return 0; | |
| 16717 | 1154920 | } | |
| 16718 | 1255696 | int32_t readmapscreen(PACKFILE *f, zquestheader *Header, mapscr *temp_mapscr, word version, int scrind) | |
| 16719 | { | ||
| 16720 |
2/2✓ Branch 0 taken 1154920 times.
✓ Branch 1 taken 100776 times.
|
1255696 | if(version < 23) |
| 16721 | { | ||
| 16722 | 1154920 | auto ret = readmapscreen_old(f,Header,temp_mapscr,version,scrind); | |
| 16723 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1154920 times.
|
1154920 | if(ret) return ret; |
| 16724 | 1154920 | } | |
| 16725 | else | ||
| 16726 | { | ||
| 16727 |
1/2✓ Branch 0 taken 100776 times.
✗ Branch 1 not taken.
|
100776 | if(!p_getc(&(temp_mapscr->valid),f)) |
| 16728 | ✗ | return qe_invalid; | |
| 16729 |
2/2✓ Branch 0 taken 41405 times.
✓ Branch 1 taken 59371 times.
|
100776 | if(!(temp_mapscr->valid & mVALID)) |
| 16730 | { | ||
| 16731 | 59371 | int map = scrind/MAPSCRS; | |
| 16732 | 59371 | int scr = scrind%MAPSCRS; | |
| 16733 |
4/6✓ Branch 0 taken 52269 times.
✓ Branch 1 taken 7102 times.
✓ Branch 2 taken 52269 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 52269 times.
|
59371 | if(version > 25 && scrind > -1 && (map*6+5) < map_autolayers.size()) |
| 16734 | { | ||
| 16735 | //Empty screen, apply autolayers | ||
| 16736 |
2/2✓ Branch 0 taken 313614 times.
✓ Branch 1 taken 52269 times.
|
365883 | for(int q = 0; q < 6; ++q) |
| 16737 | { | ||
| 16738 | 313614 | auto layermap = map_autolayers[map*6+q]; | |
| 16739 | 313614 | temp_mapscr->layermap[q] = layermap; | |
| 16740 |
2/2✓ Branch 0 taken 298458 times.
✓ Branch 1 taken 15156 times.
|
313614 | if(layermap) |
| 16741 | 15156 | temp_mapscr->layerscreen[q] = scr; | |
| 16742 | 313614 | } | |
| 16743 | 52269 | } | |
| 16744 | 59371 | return 0; | |
| 16745 | } | ||
| 16746 | uint32_t scr_has_flags; | ||
| 16747 |
1/2✓ Branch 0 taken 41405 times.
✗ Branch 1 not taken.
|
41405 | if(!p_igetl(&scr_has_flags,f)) |
| 16748 | ✗ | return qe_invalid; | |
| 16749 | |||
| 16750 |
2/2✓ Branch 0 taken 10458 times.
✓ Branch 1 taken 30947 times.
|
41405 | if(scr_has_flags & SCRHAS_ROOMDATA) |
| 16751 | { | ||
| 16752 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 30947 times.
|
30947 | if(!p_getc(&(temp_mapscr->guy),f)) |
| 16753 | ✗ | return qe_invalid; | |
| 16754 |
2/2✓ Branch 0 taken 30827 times.
✓ Branch 1 taken 120 times.
|
30947 | if(version > 26) |
| 16755 | { | ||
| 16756 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 30827 times.
|
30827 | if(!p_igetl(&(temp_mapscr->guytile),f)) |
| 16757 | ✗ | return qe_invalid; | |
| 16758 |
1/2✓ Branch 0 taken 30827 times.
✗ Branch 1 not taken.
|
30827 | if(!p_getc(&(temp_mapscr->guycs),f)) |
| 16759 | ✗ | return qe_invalid; | |
| 16760 |
1/2✓ Branch 0 taken 30827 times.
✗ Branch 1 not taken.
|
30827 | if(!p_igetw(&(temp_mapscr->roomflags),f)) |
| 16761 | ✗ | return qe_invalid; | |
| 16762 | 30827 | } | |
| 16763 | else | ||
| 16764 | { | ||
| 16765 | 120 | temp_mapscr->guytile = -1; //signal to use default guy values | |
| 16766 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 120 times.
|
120 | SETFLAG(temp_mapscr->roomflags,RFL_ALWAYS_GUY,temp_mapscr->guy==gFAIRY); |
| 16767 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 120 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
120 | SETFLAG(temp_mapscr->roomflags,RFL_GUYFIRES,temp_mapscr->guy!=gFAIRY || !get_qr(qr_NOFAIRYGUYFIRES)); |
| 16768 | } | ||
| 16769 |
1/2✓ Branch 0 taken 30947 times.
✗ Branch 1 not taken.
|
30947 | if(!p_igetw(&(temp_mapscr->str),f)) |
| 16770 | ✗ | return qe_invalid; | |
| 16771 |
1/2✓ Branch 0 taken 30947 times.
✗ Branch 1 not taken.
|
30947 | if(!p_getc(&(temp_mapscr->room),f)) |
| 16772 | ✗ | return qe_invalid; | |
| 16773 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 30947 times.
|
30947 | if(!p_igetw(&(temp_mapscr->catchall),f)) |
| 16774 | ✗ | return qe_invalid; | |
| 16775 | 30947 | } | |
| 16776 |
2/2✓ Branch 0 taken 39616 times.
✓ Branch 1 taken 1789 times.
|
41405 | if(scr_has_flags & SCRHAS_ITEM) |
| 16777 | { | ||
| 16778 |
1/2✓ Branch 0 taken 1789 times.
✗ Branch 1 not taken.
|
1789 | if(!p_getc(&(temp_mapscr->item),f)) |
| 16779 | ✗ | return qe_invalid; | |
| 16780 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1789 times.
|
1789 | if(!p_getc(&(temp_mapscr->hasitem),f)) |
| 16781 | ✗ | return qe_invalid; | |
| 16782 |
1/2✓ Branch 0 taken 1789 times.
✗ Branch 1 not taken.
|
1789 | if(!p_getc(&(temp_mapscr->itemx),f)) |
| 16783 | ✗ | return qe_invalid; | |
| 16784 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1789 times.
|
1789 | if(!p_getc(&(temp_mapscr->itemy),f)) |
| 16785 | ✗ | return qe_invalid; | |
| 16786 | 1789 | } | |
| 16787 |
2/2✓ Branch 0 taken 32991 times.
✓ Branch 1 taken 8414 times.
|
41405 | if(scr_has_flags & (SCRHAS_SWARP|SCRHAS_TWARP)) |
| 16788 | { | ||
| 16789 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8414 times.
|
8414 | if(!p_igetw(&temp_mapscr->warpreturnc,f)) |
| 16790 | ✗ | return qe_invalid; | |
| 16791 | 8414 | } | |
| 16792 |
2/2✓ Branch 0 taken 39315 times.
✓ Branch 1 taken 2090 times.
|
41405 | if(scr_has_flags & SCRHAS_TWARP) |
| 16793 | { | ||
| 16794 |
2/2✓ Branch 0 taken 8360 times.
✓ Branch 1 taken 2090 times.
|
10450 | for(int32_t i=0; i<4; i++) |
| 16795 | { | ||
| 16796 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8360 times.
|
8360 | if(!p_getc(&(temp_mapscr->tilewarptype[i]),f)) |
| 16797 | ✗ | return qe_invalid; | |
| 16798 | 8360 | } | |
| 16799 |
2/2✓ Branch 0 taken 8360 times.
✓ Branch 1 taken 2090 times.
|
10450 | for(int32_t i=0; i<4; i++) |
| 16800 | { | ||
| 16801 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8360 times.
|
8360 | if(!p_igetw(&(temp_mapscr->tilewarpdmap[i]),f)) |
| 16802 | ✗ | return qe_invalid; | |
| 16803 | 8360 | } | |
| 16804 |
2/2✓ Branch 0 taken 8360 times.
✓ Branch 1 taken 2090 times.
|
10450 | for(int32_t i=0; i<4; i++) |
| 16805 | { | ||
| 16806 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8360 times.
|
8360 | if(!p_getc(&(temp_mapscr->tilewarpscr[i]),f)) |
| 16807 | ✗ | return qe_invalid; | |
| 16808 | 8360 | } | |
| 16809 |
1/2✓ Branch 0 taken 2090 times.
✗ Branch 1 not taken.
|
2090 | if(!p_getc(&(temp_mapscr->tilewarpoverlayflags),f)) |
| 16810 | ✗ | return qe_invalid; | |
| 16811 | 2090 | } | |
| 16812 |
2/2✓ Branch 0 taken 34649 times.
✓ Branch 1 taken 6756 times.
|
41405 | if(scr_has_flags & SCRHAS_SWARP) |
| 16813 | { | ||
| 16814 |
2/2✓ Branch 0 taken 27024 times.
✓ Branch 1 taken 6756 times.
|
33780 | for(int32_t i=0; i<4; i++) |
| 16815 | { | ||
| 16816 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27024 times.
|
27024 | if(!p_getc(&(temp_mapscr->sidewarptype[i]),f)) |
| 16817 | ✗ | return qe_invalid; | |
| 16818 | 27024 | } | |
| 16819 |
2/2✓ Branch 0 taken 27024 times.
✓ Branch 1 taken 6756 times.
|
33780 | for(int32_t i=0; i<4; i++) |
| 16820 | { | ||
| 16821 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27024 times.
|
27024 | if(!p_igetw(&(temp_mapscr->sidewarpdmap[i]),f)) |
| 16822 | ✗ | return qe_invalid; | |
| 16823 | 27024 | } | |
| 16824 |
2/2✓ Branch 0 taken 27024 times.
✓ Branch 1 taken 6756 times.
|
33780 | for(int32_t i=0; i<4; i++) |
| 16825 | { | ||
| 16826 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27024 times.
|
27024 | if(!p_getc(&(temp_mapscr->sidewarpscr[i]),f)) |
| 16827 | ✗ | return qe_invalid; | |
| 16828 | 27024 | } | |
| 16829 |
1/2✓ Branch 0 taken 6756 times.
✗ Branch 1 not taken.
|
6756 | if(!p_getc(&(temp_mapscr->sidewarpoverlayflags),f)) |
| 16830 | ✗ | return qe_invalid; | |
| 16831 |
1/2✓ Branch 0 taken 6756 times.
✗ Branch 1 not taken.
|
6756 | if(!p_getc(&(temp_mapscr->sidewarpindex),f)) |
| 16832 | ✗ | return qe_invalid; | |
| 16833 | 6756 | } | |
| 16834 |
2/2✓ Branch 0 taken 36670 times.
✓ Branch 1 taken 4735 times.
|
41405 | if(scr_has_flags & SCRHAS_WARPRET) |
| 16835 | { | ||
| 16836 |
2/2✓ Branch 0 taken 18940 times.
✓ Branch 1 taken 4735 times.
|
23675 | for(int32_t i=0; i<4; i++) |
| 16837 | { | ||
| 16838 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18940 times.
|
18940 | if(!p_getc(&(temp_mapscr->warpreturnx[i]),f)) |
| 16839 | ✗ | return qe_invalid; | |
| 16840 | 18940 | } | |
| 16841 |
2/2✓ Branch 0 taken 18940 times.
✓ Branch 1 taken 4735 times.
|
23675 | for(int32_t i=0; i<4; i++) |
| 16842 | { | ||
| 16843 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18940 times.
|
18940 | if(!p_getc(&(temp_mapscr->warpreturny[i]),f)) |
| 16844 | ✗ | return qe_invalid; | |
| 16845 | 18940 | } | |
| 16846 |
1/2✓ Branch 0 taken 4735 times.
✗ Branch 1 not taken.
|
4735 | if(!p_getc(&(temp_mapscr->warparrivalx),f)) |
| 16847 | ✗ | return qe_invalid; | |
| 16848 |
1/2✓ Branch 0 taken 4735 times.
✗ Branch 1 not taken.
|
4735 | if(!p_getc(&(temp_mapscr->warparrivaly),f)) |
| 16849 | ✗ | return qe_invalid; | |
| 16850 | 4735 | } | |
| 16851 |
2/2✓ Branch 0 taken 31333 times.
✓ Branch 1 taken 10072 times.
|
41405 | if(scr_has_flags & SCRHAS_LAYERS) |
| 16852 | { | ||
| 16853 |
2/2✓ Branch 0 taken 60432 times.
✓ Branch 1 taken 10072 times.
|
70504 | for(int32_t k=0; k<6; k++) |
| 16854 | { | ||
| 16855 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 60432 times.
|
60432 | if(!p_getc(&(temp_mapscr->layermap[k]),f)) |
| 16856 | ✗ | return qe_invalid; | |
| 16857 | 60432 | } | |
| 16858 |
2/2✓ Branch 0 taken 60432 times.
✓ Branch 1 taken 10072 times.
|
70504 | for(int32_t k=0; k<6; k++) |
| 16859 | { | ||
| 16860 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 60432 times.
|
60432 | if(!p_getc(&(temp_mapscr->layerscreen[k]),f)) |
| 16861 | ✗ | return qe_invalid; | |
| 16862 | 60432 | } | |
| 16863 |
2/2✓ Branch 0 taken 60432 times.
✓ Branch 1 taken 10072 times.
|
70504 | for(int32_t k=0; k<6; k++) |
| 16864 | { | ||
| 16865 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 60432 times.
|
60432 | if(!p_getc(&(temp_mapscr->layeropacity[k]),f)) |
| 16866 | ✗ | return qe_invalid; | |
| 16867 | 60432 | } | |
| 16868 |
1/2✓ Branch 0 taken 10072 times.
✗ Branch 1 not taken.
|
10072 | if(!p_getc(&(temp_mapscr->hidelayers),f)) |
| 16869 | ✗ | return qe_invalid; | |
| 16870 |
1/2✓ Branch 0 taken 10072 times.
✗ Branch 1 not taken.
|
10072 | if(!p_getc(&(temp_mapscr->hidescriptlayers),f)) |
| 16871 | ✗ | return qe_invalid; | |
| 16872 | 10072 | } | |
| 16873 |
2/2✓ Branch 0 taken 41403 times.
✓ Branch 1 taken 2 times.
|
41405 | if(scr_has_flags & SCRHAS_MAZE) |
| 16874 | { | ||
| 16875 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 2 times.
|
10 | for(int32_t k=0; k<4; k++) |
| 16876 | { | ||
| 16877 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if(!p_getc(&(temp_mapscr->path[k]),f)) |
| 16878 | ✗ | return qe_invalid; | |
| 16879 | 8 | } | |
| 16880 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if(!p_getc(&(temp_mapscr->exitdir),f)) |
| 16881 | ✗ | return qe_invalid; | |
| 16882 | 2 | } | |
| 16883 |
2/2✓ Branch 0 taken 17123 times.
✓ Branch 1 taken 24282 times.
|
41405 | if(scr_has_flags & SCRHAS_D_S_U) |
| 16884 | { | ||
| 16885 |
1/2✓ Branch 0 taken 17123 times.
✗ Branch 1 not taken.
|
17123 | if(!p_igetw(&(temp_mapscr->door_combo_set),f)) |
| 16886 | ✗ | return qe_invalid; | |
| 16887 |
2/2✓ Branch 0 taken 68492 times.
✓ Branch 1 taken 17123 times.
|
85615 | for(int32_t k=0; k<4; k++) |
| 16888 | { | ||
| 16889 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 68492 times.
|
68492 | if(!p_getc(&(temp_mapscr->door[k]),f)) |
| 16890 | ✗ | return qe_invalid; | |
| 16891 |
3/4✓ Branch 0 taken 360 times.
✓ Branch 1 taken 68132 times.
✓ Branch 2 taken 360 times.
✗ Branch 3 not taken.
|
68492 | if(version < 29 && temp_mapscr->door[k] == dNONE) |
| 16892 | ✗ | temp_mapscr->door[k] = dWALL; | |
| 16893 | 68492 | } | |
| 16894 | |||
| 16895 |
1/2✓ Branch 0 taken 17123 times.
✗ Branch 1 not taken.
|
17123 | if(!p_getc(&(temp_mapscr->stairx),f)) |
| 16896 | ✗ | return qe_invalid; | |
| 16897 | |||
| 16898 |
1/2✓ Branch 0 taken 17123 times.
✗ Branch 1 not taken.
|
17123 | if(!p_getc(&(temp_mapscr->stairy),f)) |
| 16899 | ✗ | return qe_invalid; | |
| 16900 |
1/2✓ Branch 0 taken 17123 times.
✗ Branch 1 not taken.
|
17123 | if(!p_igetw(&(temp_mapscr->undercombo),f)) |
| 16901 | ✗ | return qe_invalid; | |
| 16902 |
1/2✓ Branch 0 taken 17123 times.
✗ Branch 1 not taken.
|
17123 | if(!p_getc(&(temp_mapscr->undercset),f)) |
| 16903 | ✗ | return qe_invalid; | |
| 16904 | 17123 | } | |
| 16905 |
2/2✓ Branch 0 taken 13794 times.
✓ Branch 1 taken 10488 times.
|
24282 | else if(version < 29) |
| 16906 | { | ||
| 16907 |
2/2✓ Branch 0 taken 41952 times.
✓ Branch 1 taken 10488 times.
|
52440 | for(int k = 0; k < 4; ++k) |
| 16908 | 41952 | temp_mapscr->door[k] = dWALL; | |
| 16909 | 10488 | } | |
| 16910 |
2/2✓ Branch 0 taken 36244 times.
✓ Branch 1 taken 5161 times.
|
41405 | if(scr_has_flags & SCRHAS_FLAGS) |
| 16911 | { | ||
| 16912 |
1/2✓ Branch 0 taken 5161 times.
✗ Branch 1 not taken.
|
5161 | if(!p_getc(&(temp_mapscr->flags),f)) |
| 16913 | ✗ | return qe_invalid; | |
| 16914 |
1/2✓ Branch 0 taken 5161 times.
✗ Branch 1 not taken.
|
5161 | if(!p_getc(&(temp_mapscr->flags2),f)) |
| 16915 | ✗ | return qe_invalid; | |
| 16916 |
1/2✓ Branch 0 taken 5161 times.
✗ Branch 1 not taken.
|
5161 | if(!p_getc(&(temp_mapscr->flags3),f)) |
| 16917 | ✗ | return qe_invalid; | |
| 16918 |
1/2✓ Branch 0 taken 5161 times.
✗ Branch 1 not taken.
|
5161 | if(!p_getc(&(temp_mapscr->flags4),f)) |
| 16919 | ✗ | return qe_invalid; | |
| 16920 |
1/2✓ Branch 0 taken 5161 times.
✗ Branch 1 not taken.
|
5161 | if(!p_getc(&(temp_mapscr->flags5),f)) |
| 16921 | ✗ | return qe_invalid; | |
| 16922 |
1/2✓ Branch 0 taken 5161 times.
✗ Branch 1 not taken.
|
5161 | if(!p_getc(&(temp_mapscr->flags6),f)) |
| 16923 | ✗ | return qe_invalid; | |
| 16924 |
1/2✓ Branch 0 taken 5161 times.
✗ Branch 1 not taken.
|
5161 | if(!p_getc(&(temp_mapscr->flags7),f)) |
| 16925 | ✗ | return qe_invalid; | |
| 16926 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5161 times.
|
5161 | if(!p_getc(&(temp_mapscr->flags8),f)) |
| 16927 | ✗ | return qe_invalid; | |
| 16928 |
1/2✓ Branch 0 taken 5161 times.
✗ Branch 1 not taken.
|
5161 | if(!p_getc(&(temp_mapscr->flags9),f)) |
| 16929 | ✗ | return qe_invalid; | |
| 16930 |
1/2✓ Branch 0 taken 5161 times.
✗ Branch 1 not taken.
|
5161 | if(!p_getc(&(temp_mapscr->flags10),f)) |
| 16931 | ✗ | return qe_invalid; | |
| 16932 |
1/2✓ Branch 0 taken 5161 times.
✗ Branch 1 not taken.
|
5161 | if(!p_getc(&(temp_mapscr->enemyflags),f)) |
| 16933 | ✗ | return qe_invalid; | |
| 16934 | 5161 | } | |
| 16935 |
2/2✓ Branch 0 taken 36897 times.
✓ Branch 1 taken 4508 times.
|
41405 | if(scr_has_flags & SCRHAS_ENEMY) |
| 16936 | { | ||
| 16937 |
2/2✓ Branch 0 taken 45080 times.
✓ Branch 1 taken 4508 times.
|
49588 | for(int32_t k=0; k<10; k++) |
| 16938 | { | ||
| 16939 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 45080 times.
|
45080 | if(!p_igetw(&(temp_mapscr->enemy[k]),f)) |
| 16940 | ✗ | return qe_invalid; | |
| 16941 |
1/2✓ Branch 0 taken 45080 times.
✗ Branch 1 not taken.
|
45080 | if (unsigned(temp_mapscr->enemy[k]) > MAXGUYS) |
| 16942 | ✗ | temp_mapscr->enemy[k] = 0; | |
| 16943 | 45080 | } | |
| 16944 |
1/2✓ Branch 0 taken 4508 times.
✗ Branch 1 not taken.
|
4508 | if(!p_getc(&(temp_mapscr->pattern),f)) |
| 16945 | ✗ | return qe_invalid; | |
| 16946 | 4508 | } | |
| 16947 |
2/2✓ Branch 0 taken 41087 times.
✓ Branch 1 taken 318 times.
|
41405 | if(scr_has_flags & SCRHAS_CARRY) |
| 16948 | { | ||
| 16949 |
1/2✓ Branch 0 taken 318 times.
✗ Branch 1 not taken.
|
318 | if(!p_igetw(&(temp_mapscr->noreset),f)) |
| 16950 | ✗ | return qe_invalid; | |
| 16951 |
1/2✓ Branch 0 taken 318 times.
✗ Branch 1 not taken.
|
318 | if(!p_igetw(&(temp_mapscr->nocarry),f)) |
| 16952 | ✗ | return qe_invalid; | |
| 16953 |
1/2✓ Branch 0 taken 318 times.
✗ Branch 1 not taken.
|
318 | if(!p_getc(&(temp_mapscr->nextmap),f)) |
| 16954 | ✗ | return qe_invalid; | |
| 16955 |
1/2✓ Branch 0 taken 318 times.
✗ Branch 1 not taken.
|
318 | if(!p_getc(&(temp_mapscr->nextscr),f)) |
| 16956 | ✗ | return qe_invalid; | |
| 16957 | 318 | } | |
| 16958 |
2/2✓ Branch 0 taken 40853 times.
✓ Branch 1 taken 552 times.
|
41405 | if(scr_has_flags & SCRHAS_SCRIPT) |
| 16959 | { | ||
| 16960 |
1/2✓ Branch 0 taken 552 times.
✗ Branch 1 not taken.
|
552 | if(!p_igetw(&(temp_mapscr->script),f)) |
| 16961 | ✗ | return qe_invalid; | |
| 16962 |
1/2✓ Branch 0 taken 552 times.
✗ Branch 1 not taken.
|
552 | if(!p_getc(&(temp_mapscr->preloadscript),f)) |
| 16963 | ✗ | return qe_invalid; | |
| 16964 |
2/2✓ Branch 0 taken 4416 times.
✓ Branch 1 taken 552 times.
|
4968 | for ( int32_t q = 0; q < 8; q++ ) |
| 16965 | { | ||
| 16966 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4416 times.
|
4416 | if(!p_igetl(&(temp_mapscr->screeninitd[q]),f)) |
| 16967 | ✗ | return qe_invalid; | |
| 16968 | 4416 | } | |
| 16969 | 552 | } | |
| 16970 |
2/2✓ Branch 0 taken 37461 times.
✓ Branch 1 taken 3944 times.
|
41405 | if(scr_has_flags & SCRHAS_SECRETS) |
| 16971 | { | ||
| 16972 |
2/2✓ Branch 0 taken 504832 times.
✓ Branch 1 taken 3944 times.
|
508776 | for(int32_t k=0; k<128; k++) |
| 16973 | { | ||
| 16974 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 504832 times.
|
504832 | if(!p_igetw(&(temp_mapscr->secretcombo[k]),f)) |
| 16975 | ✗ | return qe_invalid; | |
| 16976 | 504832 | } | |
| 16977 |
2/2✓ Branch 0 taken 504832 times.
✓ Branch 1 taken 3944 times.
|
508776 | for(int32_t k=0; k<128; k++) |
| 16978 | { | ||
| 16979 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 504832 times.
|
504832 | if(!p_getc(&(temp_mapscr->secretcset[k]),f)) |
| 16980 | ✗ | return qe_invalid; | |
| 16981 | 504832 | } | |
| 16982 |
2/2✓ Branch 0 taken 504832 times.
✓ Branch 1 taken 3944 times.
|
508776 | for(int32_t k=0; k<128; k++) |
| 16983 | { | ||
| 16984 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 504832 times.
|
504832 | if(!p_getc(&(temp_mapscr->secretflag[k]),f)) |
| 16985 | ✗ | return qe_invalid; | |
| 16986 | 504832 | } | |
| 16987 | 3944 | } | |
| 16988 |
2/2✓ Branch 0 taken 13165 times.
✓ Branch 1 taken 28240 times.
|
41405 | if(scr_has_flags & SCRHAS_COMBOFLAG) |
| 16989 | { | ||
| 16990 |
2/2✓ Branch 0 taken 4970240 times.
✓ Branch 1 taken 28240 times.
|
4998480 | for(int32_t k=0; k<176; ++k) |
| 16991 | { | ||
| 16992 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4970240 times.
|
4970240 | if(!p_igetw(&(temp_mapscr->data[k]),f)) |
| 16993 | ✗ | return qe_invalid; | |
| 16994 | 4970240 | } | |
| 16995 |
2/2✓ Branch 0 taken 4970240 times.
✓ Branch 1 taken 28240 times.
|
4998480 | for(int32_t k=0; k<176; ++k) |
| 16996 | { | ||
| 16997 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4970240 times.
|
4970240 | if(!p_getc(&(temp_mapscr->sflag[k]),f)) |
| 16998 | ✗ | return qe_invalid; | |
| 16999 | 4970240 | } | |
| 17000 |
2/2✓ Branch 0 taken 4970240 times.
✓ Branch 1 taken 28240 times.
|
4998480 | for(int32_t k=0; k<176; ++k) |
| 17001 | { | ||
| 17002 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4970240 times.
|
4970240 | if(!p_getc(&(temp_mapscr->cset[k]),f)) |
| 17003 | ✗ | return qe_invalid; | |
| 17004 | 4970240 | } | |
| 17005 | 28240 | } | |
| 17006 |
1/2✓ Branch 0 taken 41405 times.
✗ Branch 1 not taken.
|
41405 | if(scr_has_flags & SCRHAS_MISC) |
| 17007 | { | ||
| 17008 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 41405 times.
|
41405 | if(!p_igetw(&(temp_mapscr->color),f)) |
| 17009 | ✗ | return qe_invalid; | |
| 17010 |
1/2✓ Branch 0 taken 41405 times.
✗ Branch 1 not taken.
|
41405 | if(!p_getc(&(temp_mapscr->csensitive),f)) |
| 17011 | ✗ | return qe_invalid; | |
| 17012 |
1/2✓ Branch 0 taken 41405 times.
✗ Branch 1 not taken.
|
41405 | if(!p_getc(&(temp_mapscr->oceansfx),f)) |
| 17013 | ✗ | return qe_invalid; | |
| 17014 |
1/2✓ Branch 0 taken 41405 times.
✗ Branch 1 not taken.
|
41405 | if(!p_getc(&(temp_mapscr->bosssfx),f)) |
| 17015 | ✗ | return qe_invalid; | |
| 17016 |
1/2✓ Branch 0 taken 41405 times.
✗ Branch 1 not taken.
|
41405 | if(!p_getc(&(temp_mapscr->secretsfx),f)) |
| 17017 | ✗ | return qe_invalid; | |
| 17018 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 41405 times.
|
41405 | if(!p_getc(&(temp_mapscr->holdupsfx),f)) |
| 17019 | ✗ | return qe_invalid; | |
| 17020 |
1/2✓ Branch 0 taken 41405 times.
✗ Branch 1 not taken.
|
41405 | if(!p_igetw(&(temp_mapscr->timedwarptics),f)) |
| 17021 | ✗ | return qe_invalid; | |
| 17022 |
1/2✓ Branch 0 taken 41405 times.
✗ Branch 1 not taken.
|
41405 | if(!p_igetw(&(temp_mapscr->screen_midi),f)) |
| 17023 | ✗ | return qe_invalid; | |
| 17024 |
1/2✓ Branch 0 taken 41405 times.
✗ Branch 1 not taken.
|
41405 | if(!p_getc(&(temp_mapscr->lens_layer),f)) |
| 17025 | ✗ | return qe_invalid; | |
| 17026 |
2/2✓ Branch 0 taken 10578 times.
✓ Branch 1 taken 30827 times.
|
41405 | if(version > 27) |
| 17027 | { | ||
| 17028 |
1/2✓ Branch 0 taken 30827 times.
✗ Branch 1 not taken.
|
30827 | if(!p_getc(&(temp_mapscr->lens_show),f)) |
| 17029 | ✗ | return qe_invalid; | |
| 17030 |
1/2✓ Branch 0 taken 30827 times.
✗ Branch 1 not taken.
|
30827 | if(!p_getc(&(temp_mapscr->lens_hide),f)) |
| 17031 | ✗ | return qe_invalid; | |
| 17032 | 30827 | } | |
| 17033 | 41405 | } | |
| 17034 | else | ||
| 17035 | { | ||
| 17036 | ✗ | temp_mapscr->screen_midi = -1; | |
| 17037 | ✗ | temp_mapscr->csensitive = 1; | |
| 17038 | } | ||
| 17039 | //FFC | ||
| 17040 | 41405 | bool old_ff = version < 25; | |
| 17041 | 41405 | dword bits = 0; | |
| 17042 | 41405 | word numffc = 32; | |
| 17043 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 41405 times.
|
41405 | if(old_ff) |
| 17044 | { | ||
| 17045 | ✗ | if(!p_igetl(&bits,f)) | |
| 17046 | ✗ | return qe_invalid; | |
| 17047 | ✗ | } | |
| 17048 | else | ||
| 17049 | { | ||
| 17050 |
1/2✓ Branch 0 taken 41405 times.
✗ Branch 1 not taken.
|
41405 | if(!p_igetw(&numffc,f)) |
| 17051 | ✗ | return qe_invalid; | |
| 17052 | } | ||
| 17053 | byte tempbyte; | ||
| 17054 | word tempw; | ||
| 17055 |
4/6✓ Branch 0 taken 114 times.
✓ Branch 1 taken 41291 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 114 times.
✓ Branch 4 taken 114 times.
✗ Branch 5 not taken.
|
41405 | static ffcdata nil_ffc; |
| 17056 | 41405 | temp_mapscr->ffcCountMarkDirty(); | |
| 17057 | 41405 | temp_mapscr->ffcs.clear(); | |
| 17058 | 41405 | temp_mapscr->ffcs.resize(std::min(MAXFFCS, (int)numffc)); | |
| 17059 |
2/2✓ Branch 0 taken 70302 times.
✓ Branch 1 taken 41405 times.
|
111707 | for(word m = 0; m < numffc; ++m) |
| 17060 | { | ||
| 17061 |
1/2✓ Branch 0 taken 70302 times.
✗ Branch 1 not taken.
|
70302 | ffcdata& tempffc = (m < MAXFFCS) |
| 17062 | 70302 | ? temp_mapscr->ffcs[m] | |
| 17063 | : nil_ffc; //sanity | ||
| 17064 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 70302 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
70302 | if(old_ff && !(bits & (1<<m))) continue; |
| 17065 | |||
| 17066 |
1/2✓ Branch 0 taken 70302 times.
✗ Branch 1 not taken.
|
70302 | if(!p_igetw(&tempw,f)) |
| 17067 | ✗ | return qe_invalid; | |
| 17068 |
3/4✓ Branch 0 taken 70302 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12234 times.
✓ Branch 3 taken 58068 times.
|
70302 | if(!old_ff && !tempw) //empty ffc, nothing more to load |
| 17069 | 58068 | continue; | |
| 17070 | 12234 | tempffc.data = tempw; | |
| 17071 | |||
| 17072 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12234 times.
|
12234 | if(!p_getc(&(tempffc.cset),f)) |
| 17073 | ✗ | return qe_invalid; | |
| 17074 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12234 times.
|
12234 | if(!p_igetw(&(tempffc.delay),f)) |
| 17075 | ✗ | return qe_invalid; | |
| 17076 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12234 times.
|
12234 | if(!p_igetzf(&(tempffc.x),f)) |
| 17077 | ✗ | return qe_invalid; | |
| 17078 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12234 times.
|
12234 | if(!p_igetzf(&(tempffc.y),f)) |
| 17079 | ✗ | return qe_invalid; | |
| 17080 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12234 times.
|
12234 | if(!p_igetzf(&(tempffc.vx),f)) |
| 17081 | ✗ | return qe_invalid; | |
| 17082 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12234 times.
|
12234 | if(!p_igetzf(&(tempffc.vy),f)) |
| 17083 | ✗ | return qe_invalid; | |
| 17084 |
1/2✓ Branch 0 taken 12234 times.
✗ Branch 1 not taken.
|
12234 | if(!p_igetzf(&(tempffc.ax),f)) |
| 17085 | ✗ | return qe_invalid; | |
| 17086 |
1/2✓ Branch 0 taken 12234 times.
✗ Branch 1 not taken.
|
12234 | if(!p_igetzf(&(tempffc.ay),f)) |
| 17087 | ✗ | return qe_invalid; | |
| 17088 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12234 times.
|
12234 | if(!p_getc(&(tempffc.link),f)) |
| 17089 | ✗ | return qe_invalid; | |
| 17090 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12234 times.
|
12234 | if(version < 24) |
| 17091 | { | ||
| 17092 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 17093 | ✗ | return qe_invalid; | |
| 17094 | ✗ | tempffc.hit_width = (tempbyte&0x3F)+1; | |
| 17095 | ✗ | tempffc.txsz = (tempbyte>>6)+1; | |
| 17096 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 17097 | ✗ | return qe_invalid; | |
| 17098 | ✗ | tempffc.hit_height = (tempbyte&0x3F)+1; | |
| 17099 | ✗ | tempffc.tysz = (tempbyte>>6)+1; | |
| 17100 | ✗ | } | |
| 17101 | else | ||
| 17102 | { | ||
| 17103 |
1/2✓ Branch 0 taken 12234 times.
✗ Branch 1 not taken.
|
12234 | if(!p_igetl(&(tempffc.hit_width),f)) |
| 17104 | ✗ | return qe_invalid; | |
| 17105 |
1/2✓ Branch 0 taken 12234 times.
✗ Branch 1 not taken.
|
12234 | if(!p_igetl(&(tempffc.hit_height),f)) |
| 17106 | ✗ | return qe_invalid; | |
| 17107 |
1/2✓ Branch 0 taken 12234 times.
✗ Branch 1 not taken.
|
12234 | if(!p_getc(&(tempffc.txsz),f)) |
| 17108 | ✗ | return qe_invalid; | |
| 17109 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12234 times.
|
12234 | if(!p_getc(&(tempffc.tysz),f)) |
| 17110 | ✗ | return qe_invalid; | |
| 17111 | } | ||
| 17112 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12234 times.
|
12234 | if(!p_igetl(&(tempffc.flags),f)) |
| 17113 | ✗ | return qe_invalid; | |
| 17114 | 12234 | tempffc.updateSolid(); | |
| 17115 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12234 times.
|
12234 | if(!p_igetw(&(tempffc.script),f)) |
| 17116 | ✗ | return qe_invalid; | |
| 17117 |
2/2✓ Branch 0 taken 97872 times.
✓ Branch 1 taken 12234 times.
|
110106 | for(auto q = 0; q < 8; ++q) |
| 17118 | { | ||
| 17119 |
1/2✓ Branch 0 taken 97872 times.
✗ Branch 1 not taken.
|
97872 | if(!p_igetl(&(tempffc.initd[q]),f)) |
| 17120 | ✗ | return qe_invalid; | |
| 17121 | 97872 | } | |
| 17122 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12234 times.
|
12234 | if(!p_getc(&(tempbyte),f)) |
| 17123 | ✗ | return qe_invalid; | |
| 17124 | 12234 | tempffc.inita[0]=tempbyte*10000; | |
| 17125 | |||
| 17126 |
1/2✓ Branch 0 taken 12234 times.
✗ Branch 1 not taken.
|
12234 | if(!p_getc(&(tempbyte),f)) |
| 17127 | ✗ | return qe_invalid; | |
| 17128 | 12234 | tempffc.inita[1]=tempbyte*10000; | |
| 17129 | |||
| 17130 |
1/2✓ Branch 0 taken 12234 times.
✗ Branch 1 not taken.
|
12234 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 17131 | { | ||
| 17132 | ✗ | tempffc.script = 0; | |
| 17133 | ✗ | for(int q = 0; q < 8; ++q) | |
| 17134 | ✗ | tempffc.initd[q] = 0; | |
| 17135 | ✗ | } | |
| 17136 | 12234 | } | |
| 17137 | //END FFC | ||
| 17138 |
2/2✓ Branch 0 taken 35834 times.
✓ Branch 1 taken 5571 times.
|
41405 | if(version > 29) |
| 17139 |
1/2✓ Branch 0 taken 5571 times.
✗ Branch 1 not taken.
|
5571 | if(!p_getlstr(&temp_mapscr->usr_notes, f)) |
| 17140 | ✗ | return qe_invalid; | |
| 17141 | } | ||
| 17142 | |||
| 17143 | 1196325 | temp_mapscr->ffcCountMarkDirty(); | |
| 17144 | 1196325 | temp_mapscr->ffcs.resize(temp_mapscr->numFFC()); | |
| 17145 | 1196325 | temp_mapscr->ffcs.shrink_to_fit(); | |
| 17146 | |||
| 17147 | 1196325 | return 0; | |
| 17148 | 1255696 | } | |
| 17149 | |||
| 17150 | 415 | int32_t readmaps(PACKFILE *f, zquestheader *Header) | |
| 17151 | { | ||
| 17152 |
2/2✓ Branch 0 taken 391 times.
✓ Branch 1 taken 24 times.
|
415 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_maps); |
| 17153 | 415 | int32_t scr=0; | |
| 17154 | |||
| 17155 | 415 | word version=0; | |
| 17156 | dword dummy; | ||
| 17157 | int32_t screens_to_read; | ||
| 17158 | |||
| 17159 | 415 | mapscr temp_mapscr{}; | |
| 17160 | word temp_map_count; | ||
| 17161 | dword section_size; | ||
| 17162 | |||
| 17163 |
5/6✓ Branch 0 taken 397 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 391 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
|
415 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<137))) |
| 17164 | { | ||
| 17165 | 18 | screens_to_read=MAPSCRS192b136; | |
| 17166 | 18 | } | |
| 17167 | else | ||
| 17168 | { | ||
| 17169 | 397 | screens_to_read=MAPSCRS; | |
| 17170 | } | ||
| 17171 | |||
| 17172 |
2/2✓ Branch 0 taken 391 times.
✓ Branch 1 taken 24 times.
|
415 | if(Header->zelda_version > 0x192) |
| 17173 | { | ||
| 17174 | //section version info | ||
| 17175 |
2/4✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 391 times.
✗ Branch 3 not taken.
|
391 | if(!p_igetw(&version,f)) |
| 17176 | { | ||
| 17177 | ✗ | return qe_invalid; | |
| 17178 | } | ||
| 17179 | |||
| 17180 | 391 | FFCore.quest_format[vMaps] = version; | |
| 17181 | |||
| 17182 |
2/4✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 391 times.
✗ Branch 3 not taken.
|
391 | if(!p_igetw(&dummy,f)) |
| 17183 | { | ||
| 17184 | ✗ | return qe_invalid; | |
| 17185 | } | ||
| 17186 | |||
| 17187 | //section size | ||
| 17188 |
2/4✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 391 times.
✗ Branch 3 not taken.
|
391 | if(!p_igetl(§ion_size,f)) |
| 17189 | { | ||
| 17190 | ✗ | return qe_invalid; | |
| 17191 | } | ||
| 17192 | |||
| 17193 | //finally... section data | ||
| 17194 |
2/4✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 391 times.
✗ Branch 3 not taken.
|
391 | if(!p_igetw(&temp_map_count,f)) |
| 17195 | { | ||
| 17196 | ✗ | return 5; | |
| 17197 | } | ||
| 17198 | 391 | } | |
| 17199 | else | ||
| 17200 | { | ||
| 17201 | 24 | temp_map_count=map_count; | |
| 17202 | } | ||
| 17203 | |||
| 17204 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 415 times.
|
415 | if (temp_map_count > MAXMAPS) |
| 17205 | { | ||
| 17206 | ✗ | return qe_invalid; | |
| 17207 | } | ||
| 17208 | |||
| 17209 |
2/2✓ Branch 0 taken 414 times.
✓ Branch 1 taken 1 times.
|
415 | if (!should_skip) |
| 17210 | { | ||
| 17211 | 414 | const int32_t _mapsSize = MAPSCRS*temp_map_count; | |
| 17212 | 414 | TheMaps.clear(); | |
| 17213 |
1/2✓ Branch 0 taken 414 times.
✗ Branch 1 not taken.
|
414 | TheMaps.resize(_mapsSize); |
| 17214 | 414 | old_combo_pages.clear(); | |
| 17215 |
1/2✓ Branch 0 taken 414 times.
✗ Branch 1 not taken.
|
414 | old_combo_pages.resize(_mapsSize); |
| 17216 | 414 | map_autolayers.clear(); | |
| 17217 |
1/2✓ Branch 0 taken 414 times.
✗ Branch 1 not taken.
|
414 | map_autolayers.resize(temp_map_count*6); |
| 17218 | 414 | } | |
| 17219 | |||
| 17220 |
4/4✓ Branch 0 taken 415 times.
✓ Branch 1 taken 9269 times.
✓ Branch 2 taken 415 times.
✓ Branch 3 taken 9269 times.
|
9684 | for(int32_t i=0; i<temp_map_count && i<MAXMAPS; i++) |
| 17221 | { | ||
| 17222 | 9269 | byte valid=1; | |
| 17223 |
2/2✓ Branch 0 taken 772 times.
✓ Branch 1 taken 8497 times.
|
9269 | if(version > 22) |
| 17224 | { | ||
| 17225 |
2/4✓ Branch 0 taken 772 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 772 times.
✗ Branch 3 not taken.
|
772 | if(!p_getc(&valid,f)) |
| 17226 | ✗ | return qe_invalid; | |
| 17227 | 772 | } | |
| 17228 |
4/4✓ Branch 0 taken 9238 times.
✓ Branch 1 taken 31 times.
✓ Branch 2 taken 8627 times.
✓ Branch 3 taken 611 times.
|
9269 | if(valid && version > 25) |
| 17229 | { | ||
| 17230 |
2/2✓ Branch 0 taken 3666 times.
✓ Branch 1 taken 611 times.
|
4277 | for(int q = 0; q < 6; ++q) |
| 17231 | { | ||
| 17232 |
2/4✓ Branch 0 taken 3666 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3666 times.
✗ Branch 3 not taken.
|
3666 | if(!p_igetw(&map_autolayers[i*6+q],f)) |
| 17233 | ✗ | return qe_invalid; | |
| 17234 | 3666 | } | |
| 17235 | 611 | } | |
| 17236 |
2/2✓ Branch 0 taken 1259912 times.
✓ Branch 1 taken 9269 times.
|
1269181 | for(int32_t j=0; j<screens_to_read; j++) |
| 17237 | { | ||
| 17238 | 1259912 | scr=i*MAPSCRS+j; | |
| 17239 |
2/2✓ Branch 0 taken 272 times.
✓ Branch 1 taken 1259640 times.
|
1259912 | mapscr* screen = should_skip ? &temp_mapscr : &TheMaps[scr]; |
| 17240 |
2/2✓ Branch 0 taken 1255696 times.
✓ Branch 1 taken 4216 times.
|
1259912 | if(valid) |
| 17241 |
1/2✓ Branch 0 taken 1255696 times.
✗ Branch 1 not taken.
|
1255696 | readmapscreen(f, Header, screen, version, scr); |
| 17242 |
1/2✓ Branch 0 taken 4216 times.
✗ Branch 1 not taken.
|
4216 | else if (!should_skip) |
| 17243 |
1/2✓ Branch 0 taken 4216 times.
✗ Branch 1 not taken.
|
4216 | clear_screen(screen); |
| 17244 | 1259912 | } | |
| 17245 | |||
| 17246 |
2/2✓ Branch 0 taken 9267 times.
✓ Branch 1 taken 2 times.
|
9269 | if (should_skip) |
| 17247 | 2 | continue; | |
| 17248 | |||
| 17249 |
5/6✓ Branch 0 taken 9099 times.
✓ Branch 1 taken 168 times.
✓ Branch 2 taken 18 times.
✓ Branch 3 taken 9081 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 18 times.
|
9267 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<137))) |
| 17250 | { | ||
| 17251 | 168 | int32_t index = (i*MAPSCRS+132); | |
| 17252 | |||
| 17253 |
1/2✓ Branch 0 taken 168 times.
✗ Branch 1 not taken.
|
168 | TheMaps[index]=TheMaps[index-1]; |
| 17254 | |||
| 17255 | 168 | MEMCPY_ARR(TheMaps[i*MAPSCRS+132].data, TheMaps[i*MAPSCRS+131].data); | |
| 17256 | 168 | MEMCPY_ARR(TheMaps[i*MAPSCRS+132].sflag, TheMaps[i*MAPSCRS+131].sflag); | |
| 17257 | 168 | MEMCPY_ARR(TheMaps[i*MAPSCRS+132].cset, TheMaps[i*MAPSCRS+131].cset); | |
| 17258 | |||
| 17259 |
2/2✓ Branch 0 taken 504 times.
✓ Branch 1 taken 168 times.
|
672 | for(int32_t j=133; j<MAPSCRS; j++) |
| 17260 | { | ||
| 17261 | 504 | scr=i*MAPSCRS+j; | |
| 17262 | |||
| 17263 |
1/2✓ Branch 0 taken 504 times.
✗ Branch 1 not taken.
|
504 | TheMaps[scr].zero_memory(); |
| 17264 | 504 | TheMaps[scr].valid = mVERSION; | |
| 17265 | 504 | TheMaps[scr].screen_midi = -1; | |
| 17266 | 504 | TheMaps[scr].csensitive = 1; | |
| 17267 | 504 | } | |
| 17268 | 168 | } | |
| 17269 | |||
| 17270 |
5/6✓ Branch 0 taken 9099 times.
✓ Branch 1 taken 168 times.
✓ Branch 2 taken 18 times.
✓ Branch 3 taken 9081 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 18 times.
|
9267 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<154))) |
| 17271 | { | ||
| 17272 |
2/2✓ Branch 0 taken 22848 times.
✓ Branch 1 taken 168 times.
|
23016 | for(int32_t j=0; j<MAPSCRS; j++) |
| 17273 | { | ||
| 17274 | 22848 | scr=i*MAPSCRS+j; | |
| 17275 | 22848 | TheMaps[scr].door_combo_set=MakeDoors(i, j); | |
| 17276 | |||
| 17277 |
2/2✓ Branch 0 taken 2924544 times.
✓ Branch 1 taken 22848 times.
|
2947392 | for(int32_t k=0; k<128; k++) |
| 17278 | { | ||
| 17279 |
1/2✓ Branch 0 taken 2924544 times.
✗ Branch 1 not taken.
|
2924544 | TheMaps[scr].secretcset[k]=tcmbcset2(i, TheMaps[scr].secretcombo[k]); |
| 17280 |
1/2✓ Branch 0 taken 2924544 times.
✗ Branch 1 not taken.
|
2924544 | TheMaps[scr].secretflag[k]=tcmbflag2(i, TheMaps[scr].secretcombo[k]); |
| 17281 |
1/2✓ Branch 0 taken 2924544 times.
✗ Branch 1 not taken.
|
2924544 | TheMaps[scr].secretcombo[k]=tcmbdat2(i, j, TheMaps[scr].secretcombo[k]); |
| 17282 | 2924544 | } | |
| 17283 | 22848 | } | |
| 17284 | 168 | } | |
| 17285 | 9267 | } | |
| 17286 | 415 | map_count = temp_map_count; | |
| 17287 |
1/2✓ Branch 0 taken 415 times.
✗ Branch 1 not taken.
|
415 | clear_screen(&temp_mapscr); |
| 17288 | 415 | return 0; | |
| 17289 | 415 | } | |
| 17290 | |||
| 17291 | |||
| 17292 | 8417296 | void update_combo(newcombo& cmb, word section_version) | |
| 17293 | { | ||
| 17294 |
2/2✓ Branch 0 taken 842565 times.
✓ Branch 1 taken 7574731 times.
|
8417296 | if(section_version < 40) |
| 17295 | { | ||
| 17296 |
3/3✓ Branch 0 taken 5025 times.
✓ Branch 1 taken 44980 times.
✓ Branch 2 taken 7524726 times.
|
7574731 | switch(cmb.type) |
| 17297 | { | ||
| 17298 | case cWATER: case cSHALLOWWATER: | ||
| 17299 | 44980 | cmb.attribytes[6] = iwRipples; | |
| 17300 | 44980 | break; | |
| 17301 | case cTALLGRASS: case cTALLGRASSNEXT: case cTALLGRASSTOUCHY: | ||
| 17302 | 5025 | cmb.attribytes[6] = iwTallGrass; | |
| 17303 | 5025 | break; | |
| 17304 | } | ||
| 17305 | 7574731 | } | |
| 17306 | 8417296 | } | |
| 17307 | 277 | int32_t readcombos_old(word section_version, PACKFILE *f, zquestheader *, word version, word build, word start_combo, word max_combos) | |
| 17308 | { | ||
| 17309 |
2/2✓ Branch 0 taken 253 times.
✓ Branch 1 taken 24 times.
|
277 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_combos); |
| 17310 | |||
| 17311 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 276 times.
|
277 | if (!should_skip) |
| 17312 | { | ||
| 17313 | 276 | reset_combo_animations(); | |
| 17314 | 276 | reset_combo_animations2(); | |
| 17315 | 276 | init_combo_classes(); | |
| 17316 | 276 | } | |
| 17317 | |||
| 17318 | // combos | ||
| 17319 | 277 | word combos_used=0; | |
| 17320 | int32_t dummy; | ||
| 17321 | byte padding; | ||
| 17322 | 277 | newcombo temp_combo; | |
| 17323 | //word section_cversion=0; | ||
| 17324 | |||
| 17325 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 276 times.
|
277 | if (!should_skip) |
| 17326 |
2/2✓ Branch 0 taken 18017280 times.
✓ Branch 1 taken 276 times.
|
18017556 | for(int32_t q = start_combo; q < start_combo+max_combos; ++q) |
| 17327 |
1/2✓ Branch 0 taken 18017280 times.
✗ Branch 1 not taken.
|
18017556 | combobuf[q].clear(); |
| 17328 | |||
| 17329 | // if(version > 0x192) | ||
| 17330 | // { | ||
| 17331 | // //section version info | ||
| 17332 | // if(!p_igetw(§ion_version,f)) | ||
| 17333 | // { | ||
| 17334 | // return qe_invalid; | ||
| 17335 | // } | ||
| 17336 | |||
| 17337 | // FFCore.quest_format[vCombos] = section_version; | ||
| 17338 | |||
| 17339 | // if(!p_igetw(§ion_cversion,f)) | ||
| 17340 | // { | ||
| 17341 | // return qe_invalid; | ||
| 17342 | // } | ||
| 17343 | |||
| 17344 | // //section size | ||
| 17345 | // if(!p_igetl(&dummy,f)) | ||
| 17346 | // { | ||
| 17347 | // return qe_invalid; | ||
| 17348 | // } | ||
| 17349 | // } | ||
| 17350 | |||
| 17351 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 277 times.
|
277 | if(version < 0x174) |
| 17352 | { | ||
| 17353 | ✗ | combos_used=1024; | |
| 17354 | ✗ | } | |
| 17355 |
2/2✓ Branch 0 taken 259 times.
✓ Branch 1 taken 18 times.
|
277 | else if(version < 0x191) |
| 17356 | { | ||
| 17357 | 18 | combos_used=2048; | |
| 17358 | 18 | } | |
| 17359 | else | ||
| 17360 | { | ||
| 17361 |
2/4✓ Branch 0 taken 259 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 259 times.
✗ Branch 3 not taken.
|
259 | if(!p_igetw(&combos_used,f)) |
| 17362 | { | ||
| 17363 | ✗ | return qe_invalid; | |
| 17364 | } | ||
| 17365 | } | ||
| 17366 | |||
| 17367 | //finally... section data | ||
| 17368 |
2/2✓ Branch 0 taken 7439715 times.
✓ Branch 1 taken 277 times.
|
7439992 | for(int32_t i=0; i<combos_used; i++) |
| 17369 | { | ||
| 17370 |
1/2✓ Branch 0 taken 7439715 times.
✗ Branch 1 not taken.
|
7439715 | temp_combo.clear(); |
| 17371 | |||
| 17372 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7236747 times.
|
7439715 | if ( section_version >= 11 ) |
| 17373 | { | ||
| 17374 |
2/4✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202968 times.
✗ Branch 3 not taken.
|
202968 | if(!p_igetl(&temp_combo.tile,f)) |
| 17375 | { | ||
| 17376 | ✗ | return qe_invalid; | |
| 17377 | } | ||
| 17378 | 202968 | } | |
| 17379 | else | ||
| 17380 | { | ||
| 17381 |
2/4✓ Branch 0 taken 7236747 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7236747 times.
✗ Branch 3 not taken.
|
7236747 | if(!p_igetw(&temp_combo.tile,f)) |
| 17382 | { | ||
| 17383 | ✗ | return qe_invalid; | |
| 17384 | } | ||
| 17385 | } | ||
| 17386 | 7439715 | temp_combo.o_tile = temp_combo.tile; | |
| 17387 |
2/4✓ Branch 0 taken 7439715 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7439715 times.
✗ Branch 3 not taken.
|
7439715 | if(!p_getc(&temp_combo.flip,f)) |
| 17388 | { | ||
| 17389 | ✗ | return qe_invalid; | |
| 17390 | } | ||
| 17391 | |||
| 17392 |
2/4✓ Branch 0 taken 7439715 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7439715 times.
✗ Branch 3 not taken.
|
7439715 | if(!p_getc(&temp_combo.walk,f)) |
| 17393 | { | ||
| 17394 | ✗ | return qe_invalid; | |
| 17395 | } | ||
| 17396 | |||
| 17397 |
2/4✓ Branch 0 taken 7439715 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7439715 times.
✗ Branch 3 not taken.
|
7439715 | if(!p_getc(&temp_combo.type,f)) |
| 17398 | { | ||
| 17399 | ✗ | return qe_invalid; | |
| 17400 | } | ||
| 17401 | |||
| 17402 |
2/4✓ Branch 0 taken 7439715 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7439715 times.
✗ Branch 3 not taken.
|
7439715 | if(!p_getc(&temp_combo.csets,f)) |
| 17403 | { | ||
| 17404 | ✗ | return qe_invalid; | |
| 17405 | } | ||
| 17406 | |||
| 17407 |
2/2✓ Branch 0 taken 69774 times.
✓ Branch 1 taken 7369941 times.
|
7439715 | if(version < 0x193) |
| 17408 | { | ||
| 17409 |
2/4✓ Branch 0 taken 69774 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69774 times.
✗ Branch 3 not taken.
|
69774 | if(!p_getc(&padding,f)) |
| 17410 | ✗ | return qe_invalid; | |
| 17411 | |||
| 17412 |
2/4✓ Branch 0 taken 69774 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69774 times.
✗ Branch 3 not taken.
|
69774 | if(!p_getc(&padding,f)) |
| 17413 | ✗ | return qe_invalid; | |
| 17414 | |||
| 17415 |
2/2✓ Branch 0 taken 32910 times.
✓ Branch 1 taken 36864 times.
|
69774 | if(version < 0x192) |
| 17416 | { | ||
| 17417 |
1/2✓ Branch 0 taken 36864 times.
✗ Branch 1 not taken.
|
36864 | if(version == 0x191) |
| 17418 | { | ||
| 17419 | ✗ | for(int32_t tmpcounter=0; tmpcounter<16; tmpcounter++) | |
| 17420 | { | ||
| 17421 | ✗ | if(!p_getc(&padding,f)) | |
| 17422 | ✗ | return qe_invalid; | |
| 17423 | ✗ | } | |
| 17424 | ✗ | } | |
| 17425 | 36864 | } | |
| 17426 | 69774 | } | |
| 17427 |
2/2✓ Branch 0 taken 7402851 times.
✓ Branch 1 taken 36864 times.
|
7439715 | if(version >= 0x192) |
| 17428 | { | ||
| 17429 |
2/4✓ Branch 0 taken 7402851 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7402851 times.
✗ Branch 3 not taken.
|
7402851 | if(!p_getc(&temp_combo.frames,f)) |
| 17430 | ✗ | return qe_invalid; | |
| 17431 | |||
| 17432 |
2/4✓ Branch 0 taken 7402851 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7402851 times.
✗ Branch 3 not taken.
|
7402851 | if(!p_getc(&temp_combo.speed,f)) |
| 17433 | ✗ | return qe_invalid; | |
| 17434 | |||
| 17435 |
2/4✓ Branch 0 taken 7402851 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7402851 times.
✗ Branch 3 not taken.
|
7402851 | if(!p_igetw(&temp_combo.nextcombo,f)) |
| 17436 | ✗ | return qe_invalid; | |
| 17437 | |||
| 17438 |
2/4✓ Branch 0 taken 7402851 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7402851 times.
✗ Branch 3 not taken.
|
7402851 | if(!p_getc(&temp_combo.nextcset,f)) |
| 17439 | ✗ | return qe_invalid; | |
| 17440 | |||
| 17441 | //Base flag | ||
| 17442 |
2/2✓ Branch 0 taken 4514443 times.
✓ Branch 1 taken 2888408 times.
|
7402851 | if(section_version>=3) |
| 17443 |
2/4✓ Branch 0 taken 4514443 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4514443 times.
✗ Branch 3 not taken.
|
4514443 | if(!p_getc(&temp_combo.flag,f)) |
| 17444 | ✗ | return qe_invalid; | |
| 17445 | |||
| 17446 |
2/2✓ Branch 0 taken 4514443 times.
✓ Branch 1 taken 2888408 times.
|
7402851 | if(section_version>=4) |
| 17447 | { | ||
| 17448 |
2/4✓ Branch 0 taken 4514443 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4514443 times.
✗ Branch 3 not taken.
|
4514443 | if(!p_getc(&temp_combo.skipanim,f)) |
| 17449 | ✗ | return qe_invalid; | |
| 17450 | |||
| 17451 |
2/4✓ Branch 0 taken 4514443 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4514443 times.
✗ Branch 3 not taken.
|
4514443 | if(!p_igetw(&temp_combo.nexttimer,f)) |
| 17452 | ✗ | return qe_invalid; | |
| 17453 | 4514443 | } | |
| 17454 | |||
| 17455 |
2/2✓ Branch 0 taken 4514443 times.
✓ Branch 1 taken 2888408 times.
|
7402851 | if(section_version>=5) |
| 17456 |
2/4✓ Branch 0 taken 4514443 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4514443 times.
✗ Branch 3 not taken.
|
4514443 | if(!p_getc(&temp_combo.skipanimy,f)) |
| 17457 | ✗ | return qe_invalid; | |
| 17458 | |||
| 17459 |
2/2✓ Branch 0 taken 4514443 times.
✓ Branch 1 taken 2888408 times.
|
7402851 | if(section_version>=6) |
| 17460 | { | ||
| 17461 |
2/4✓ Branch 0 taken 4514443 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4514443 times.
✗ Branch 3 not taken.
|
4514443 | if(!p_getc(&temp_combo.animflags,f)) |
| 17462 | ✗ | return qe_invalid; | |
| 17463 | |||
| 17464 |
1/2✓ Branch 0 taken 4514443 times.
✗ Branch 1 not taken.
|
4514443 | if(section_version == 6) |
| 17465 | ✗ | temp_combo.animflags = temp_combo.animflags ? AF_FRESH : 0; | |
| 17466 | 4514443 | } | |
| 17467 | |||
| 17468 |
2/2✓ Branch 0 taken 7199883 times.
✓ Branch 1 taken 202968 times.
|
7402851 | if(section_version>=8) //combo Attributes[4] and userflags. |
| 17469 | { | ||
| 17470 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 811872 times.
|
1014840 | for ( int32_t q = 0; q < NUM_COMBO_ATTRIBUTES; q++ ) |
| 17471 |
2/4✓ Branch 0 taken 811872 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 811872 times.
✗ Branch 3 not taken.
|
811872 | if(!p_igetl(&temp_combo.attributes[q],f)) |
| 17472 | ✗ | return qe_invalid; | |
| 17473 |
2/4✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202968 times.
✗ Branch 3 not taken.
|
202968 | if(!p_igetl(&temp_combo.usrflags,f)) |
| 17474 | ✗ | return qe_invalid; | |
| 17475 |
1/2✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
|
202968 | if(section_version >= 20) |
| 17476 |
2/4✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202968 times.
✗ Branch 3 not taken.
|
202968 | if(!p_igetw(&temp_combo.genflags,f)) |
| 17477 | ✗ | return qe_invalid; | |
| 17478 | 202968 | } | |
| 17479 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7199883 times.
|
7402851 | if(section_version>=10) //combo trigger flags |
| 17480 | { | ||
| 17481 |
2/2✓ Branch 0 taken 608904 times.
✓ Branch 1 taken 202968 times.
|
811872 | for ( int32_t q = 0; q < 3; q++ ) |
| 17482 |
2/4✓ Branch 0 taken 608904 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 608904 times.
✗ Branch 3 not taken.
|
608904 | if(!p_igetl(&temp_combo.triggerflags[q],f)) |
| 17483 | ✗ | return qe_invalid; | |
| 17484 | 202968 | } | |
| 17485 |
1/2✓ Branch 0 taken 7199883 times.
✗ Branch 1 not taken.
|
7199883 | else if(section_version==9) //combo trigger flags, V9 only had two indices of triggerflags[] |
| 17486 | { | ||
| 17487 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 17488 | ✗ | if(!p_igetl(&temp_combo.triggerflags[q],f)) | |
| 17489 | ✗ | return qe_invalid; | |
| 17490 | ✗ | } | |
| 17491 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7199883 times.
|
7402851 | if(section_version >= 9) |
| 17492 |
2/4✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202968 times.
✗ Branch 3 not taken.
|
202968 | if(!p_igetl(&temp_combo.triggerlevel,f)) |
| 17493 | ✗ | return qe_invalid; | |
| 17494 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7199883 times.
|
7402851 | if(section_version >= 22) |
| 17495 |
2/4✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202968 times.
✗ Branch 3 not taken.
|
202968 | if(!p_getc(&temp_combo.triggerbtn,f)) |
| 17496 | ✗ | return qe_invalid; | |
| 17497 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7402851 times.
|
7402851 | if(section_version >= 24) |
| 17498 | { | ||
| 17499 | ✗ | if(!p_getc(&temp_combo.triggeritem,f)) | |
| 17500 | ✗ | return qe_invalid; | |
| 17501 | ✗ | if(!p_getc(&temp_combo.trigtimer,f)) | |
| 17502 | ✗ | return qe_invalid; | |
| 17503 | ✗ | } | |
| 17504 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7402851 times.
|
7402851 | if(section_version >= 25) |
| 17505 | ✗ | if(!p_getc(&temp_combo.trigsfx,f)) | |
| 17506 | ✗ | return qe_invalid; | |
| 17507 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7402851 times.
|
7402851 | if(section_version >= 27) |
| 17508 | ✗ | if(!p_igetl(&temp_combo.trigchange,f)) | |
| 17509 | ✗ | return qe_invalid; | |
| 17510 | |||
| 17511 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7402851 times.
|
7402851 | if(section_version >= 29) |
| 17512 | { | ||
| 17513 | ✗ | if(!p_igetw(&temp_combo.trigprox,f)) | |
| 17514 | ✗ | return qe_invalid; | |
| 17515 | ✗ | if(!p_getc(&temp_combo.trigctr,f)) | |
| 17516 | ✗ | return qe_invalid; | |
| 17517 | ✗ | if(!p_igetl(&temp_combo.trigctramnt,f)) | |
| 17518 | ✗ | return qe_invalid; | |
| 17519 | ✗ | } | |
| 17520 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7402851 times.
|
7402851 | if(section_version >= 30) |
| 17521 | ✗ | if(!p_getc(&temp_combo.triglbeam,f)) | |
| 17522 | ✗ | return qe_invalid; | |
| 17523 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7402851 times.
|
7402851 | if(section_version >= 31) |
| 17524 | { | ||
| 17525 | ✗ | if(!p_getc(&temp_combo.trigcschange,f)) | |
| 17526 | ✗ | return qe_invalid; | |
| 17527 | ✗ | if(!p_igetw(&temp_combo.spawnitem,f)) | |
| 17528 | ✗ | return qe_invalid; | |
| 17529 | ✗ | if(!p_igetw(&temp_combo.spawnenemy,f)) | |
| 17530 | ✗ | return qe_invalid; | |
| 17531 | ✗ | if(!p_getc(&temp_combo.exstate,f)) | |
| 17532 | ✗ | return qe_invalid; | |
| 17533 | ✗ | if(!p_igetl(&temp_combo.spawnip,f)) | |
| 17534 | ✗ | return qe_invalid; | |
| 17535 | ✗ | if(!p_getc(&temp_combo.trigcopycat,f)) | |
| 17536 | ✗ | return qe_invalid; | |
| 17537 | ✗ | } | |
| 17538 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7402851 times.
|
7402851 | if(section_version >= 32) |
| 17539 | ✗ | if(!p_getc(&temp_combo.trigcooldown,f)) | |
| 17540 | ✗ | return qe_invalid; | |
| 17541 | |||
| 17542 |
2/2✓ Branch 0 taken 7199883 times.
✓ Branch 1 taken 202968 times.
|
7402851 | if(section_version>=12) //combo label |
| 17543 | { | ||
| 17544 | char label[12]; | ||
| 17545 | 202968 | label[11] = '\0'; | |
| 17546 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 2232648 times.
|
2435616 | for ( int32_t q = 0; q < 11; q++ ) |
| 17547 |
2/4✓ Branch 0 taken 2232648 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2232648 times.
✗ Branch 3 not taken.
|
2232648 | if(!p_getc(&label[q],f)) |
| 17548 | ✗ | return qe_invalid; | |
| 17549 |
1/2✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
|
202968 | temp_combo.label = label; |
| 17550 | 202968 | } | |
| 17551 |
2/2✓ Branch 0 taken 7199883 times.
✓ Branch 1 taken 202968 times.
|
7402851 | if(section_version>=13) //attribytes[4] |
| 17552 |
2/2✓ Branch 0 taken 811872 times.
✓ Branch 1 taken 202968 times.
|
1014840 | for ( int32_t q = 0; q < 4; q++ ) |
| 17553 |
2/4✓ Branch 0 taken 811872 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 811872 times.
✗ Branch 3 not taken.
|
811872 | if(!p_getc(&temp_combo.attribytes[q],f)) |
| 17554 | 202968 | return qe_invalid; | |
| 17555 | /* HIGHLY UNORTHODOX UPDATING THING, by Deedee | ||
| 17556 | * This fixes a poor implementation of a ->next flag bug thing. | ||
| 17557 | * Zoria didn't bump up the versions as liberally as he should have, but thankfully | ||
| 17558 | * there was a version bump a few weeks before a change that broke stuff. | ||
| 17559 | */ | ||
| 17560 |
3/4✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7199883 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 202968 times.
|
7402851 | if (section_version >= 13 && section_version < 21) |
| 17561 | { | ||
| 17562 | ✗ | set_qr(qr_BUGGY_BUGGY_SLASH_TRIGGERS,1); | |
| 17563 | ✗ | } | |
| 17564 | //combo scripts | ||
| 17565 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7199883 times.
|
7402851 | if(section_version>=14) |
| 17566 | { | ||
| 17567 |
2/4✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202968 times.
✗ Branch 3 not taken.
|
202968 | if(!p_igetw(&temp_combo.script,f)) |
| 17568 | ✗ | return qe_invalid; | |
| 17569 |
2/2✓ Branch 0 taken 405936 times.
✓ Branch 1 taken 202968 times.
|
608904 | for ( int32_t q = 0; q < 2; q++ ) |
| 17570 |
2/4✓ Branch 0 taken 405936 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 405936 times.
✗ Branch 3 not taken.
|
405936 | if(!p_igetl(&temp_combo.initd[q],f)) |
| 17571 | ✗ | return qe_invalid; | |
| 17572 | 202968 | } | |
| 17573 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7199883 times.
|
7402851 | if(section_version>=15) |
| 17574 | { | ||
| 17575 |
2/4✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202968 times.
✗ Branch 3 not taken.
|
202968 | if(!p_igetl(&temp_combo.o_tile,f)) return qe_invalid; |
| 17576 |
2/2✓ Branch 0 taken 107633 times.
✓ Branch 1 taken 95335 times.
|
202968 | if(!temp_combo.o_tile) temp_combo.o_tile = temp_combo.tile; |
| 17577 |
2/4✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202968 times.
✗ Branch 3 not taken.
|
202968 | if(!p_getc(&temp_combo.cur_frame,f)) return qe_invalid; |
| 17578 |
2/4✓ Branch 0 taken 202968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202968 times.
✗ Branch 3 not taken.
|
202968 | if(!p_getc(&temp_combo.aclk,f)) return qe_invalid; |
| 17579 | 202968 | } | |
| 17580 |
2/2✓ Branch 0 taken 7199883 times.
✓ Branch 1 taken 202968 times.
|
7402851 | if(section_version>=17) //attribytes[4] |
| 17581 | { | ||
| 17582 |
2/2✓ Branch 0 taken 811872 times.
✓ Branch 1 taken 202968 times.
|
1014840 | for ( int32_t q = 4; q < 8; q++ ) //bump up attribytes... |
| 17583 |
2/4✓ Branch 0 taken 811872 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 811872 times.
✗ Branch 3 not taken.
|
811872 | if(!p_getc(&temp_combo.attribytes[q],f)) |
| 17584 | ✗ | return qe_invalid; | |
| 17585 |
2/2✓ Branch 0 taken 1623744 times.
✓ Branch 1 taken 202968 times.
|
1826712 | for ( int32_t q = 0; q < 8; q++ ) //...and add attrishorts |
| 17586 |
2/4✓ Branch 0 taken 1623744 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1623744 times.
✗ Branch 3 not taken.
|
1623744 | if(!p_igetw(&temp_combo.attrishorts[q],f)) |
| 17587 | ✗ | return qe_invalid; | |
| 17588 | 202968 | } | |
| 17589 | |||
| 17590 |
2/2✓ Branch 0 taken 7369941 times.
✓ Branch 1 taken 32910 times.
|
7402851 | if(version < 0x193) |
| 17591 |
2/2✓ Branch 0 taken 362010 times.
✓ Branch 1 taken 32910 times.
|
394920 | for(int32_t q=0; q<11; q++) |
| 17592 |
2/4✓ Branch 0 taken 362010 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 362010 times.
✗ Branch 3 not taken.
|
362010 | if(!p_getc(&dummy,f)) |
| 17593 | 32910 | return qe_invalid; | |
| 17594 | 7402851 | } | |
| 17595 | |||
| 17596 | //Goriya tiles were flipped around in 2.11 build 7. Compensate for the flip here. -DD | ||
| 17597 |
3/6✓ Branch 0 taken 4514443 times.
✓ Branch 1 taken 2925272 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4514443 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
7439715 | if((version < 0x211)||((version == 0x211)&&(build<7))) |
| 17598 | { | ||
| 17599 |
2/2✓ Branch 0 taken 2885336 times.
✓ Branch 1 taken 39936 times.
|
2925272 | if(!get_qr(qr_NEWENEMYTILES)) |
| 17600 | { | ||
| 17601 |
1/5✓ Branch 0 taken 39936 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
39936 | switch(temp_combo.tile) |
| 17602 | { | ||
| 17603 | case 130: | ||
| 17604 | ✗ | temp_combo.tile = 132; | |
| 17605 | ✗ | break; | |
| 17606 | |||
| 17607 | case 131: | ||
| 17608 | ✗ | temp_combo.tile = 133; | |
| 17609 | ✗ | break; | |
| 17610 | |||
| 17611 | case 132: | ||
| 17612 | ✗ | temp_combo.tile = 130; | |
| 17613 | ✗ | break; | |
| 17614 | |||
| 17615 | case 133: | ||
| 17616 | ✗ | temp_combo.tile = 131; | |
| 17617 | ✗ | break; | |
| 17618 | } | ||
| 17619 | 39936 | } | |
| 17620 | 2925272 | } | |
| 17621 | |||
| 17622 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7236747 times.
|
7439715 | if(section_version < 15) |
| 17623 | 7236747 | temp_combo.o_tile = temp_combo.tile; | |
| 17624 | |||
| 17625 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7236747 times.
|
7439715 | if(section_version<18) //upper bits for .walk |
| 17626 | 7236747 | temp_combo.walk |= 0xF0; | |
| 17627 | |||
| 17628 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7236747 times.
|
7439715 | if(section_version < 19) |
| 17629 |
2/2✓ Branch 0 taken 28946988 times.
✓ Branch 1 taken 7236747 times.
|
36183735 | for(int32_t q = 0; q < 4; ++q) |
| 17630 | 36183735 | temp_combo.attributes[q] *= 10000L; | |
| 17631 | |||
| 17632 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7439715 times.
|
7439715 | if(section_version < 23) |
| 17633 | { | ||
| 17634 |
2/2✓ Branch 0 taken 14731 times.
✓ Branch 1 taken 7424984 times.
|
7439715 | switch(temp_combo.type) //combotriggerCMBTYPEFX now required for combotype-specific effects |
| 17635 | { | ||
| 17636 | case cSCRIPT1: case cSCRIPT2: case cSCRIPT3: case cSCRIPT4: case cSCRIPT5: | ||
| 17637 | case cSCRIPT6: case cSCRIPT7: case cSCRIPT8: case cSCRIPT9: case cSCRIPT10: | ||
| 17638 | case cTRIGGERGENERIC: case cCSWITCH: | ||
| 17639 | 14731 | temp_combo.triggerflags[0] |= combotriggerCMBTYPEFX; | |
| 17640 | 14731 | } | |
| 17641 | 7439715 | } | |
| 17642 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7439715 times.
|
7439715 | if(section_version < 25) |
| 17643 | { | ||
| 17644 |
2/2✓ Branch 0 taken 26963 times.
✓ Branch 1 taken 7412752 times.
|
7439715 | switch(temp_combo.type) |
| 17645 | { | ||
| 17646 | case cLOCKBLOCK: case cBOSSLOCKBLOCK: | ||
| 17647 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26963 times.
|
26963 | if(!(temp_combo.usrflags & cflag3)) |
| 17648 | 26963 | temp_combo.attribytes[3] = WAV_DOOR; | |
| 17649 | 26963 | temp_combo.usrflags &= ~cflag3; | |
| 17650 | 26963 | break; | |
| 17651 | } | ||
| 17652 | 7439715 | } | |
| 17653 | |||
| 17654 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7439715 times.
|
7439715 | if(section_version < 26) |
| 17655 |
2/2✓ Branch 0 taken 7438615 times.
✓ Branch 1 taken 1100 times.
|
7440815 | if(temp_combo.type == cARMOS) |
| 17656 |
1/2✓ Branch 0 taken 1100 times.
✗ Branch 1 not taken.
|
1100 | if(temp_combo.usrflags & cflag1) |
| 17657 | ✗ | temp_combo.usrflags |= cflag3; | |
| 17658 | |||
| 17659 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7439715 times.
|
7439715 | if(section_version < 27) |
| 17660 | { | ||
| 17661 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7439715 times.
|
7439715 | if(temp_combo.triggerflags[0] & 0x00040000) //'next' |
| 17662 | ✗ | temp_combo.trigchange = 1; | |
| 17663 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7439715 times.
|
7439715 | else if(temp_combo.triggerflags[0] & 0x00080000) //'prev' |
| 17664 | ✗ | temp_combo.trigchange = -1; | |
| 17665 | 7439715 | else temp_combo.trigchange = 0; | |
| 17666 | 7439715 | temp_combo.triggerflags[0] &= ~(0x00040000|0x00080000); | |
| 17667 | 7439715 | } | |
| 17668 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7439715 times.
|
7439715 | if(section_version < 28) |
| 17669 | { | ||
| 17670 |
2/2✓ Branch 0 taken 15216 times.
✓ Branch 1 taken 7424499 times.
|
7439715 | switch(temp_combo.type) |
| 17671 | { | ||
| 17672 | case cLOCKBLOCK: case cLOCKEDCHEST: | ||
| 17673 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15216 times.
|
15216 | if(temp_combo.usrflags & cflag7) |
| 17674 | ✗ | temp_combo.usrflags |= cflag8; | |
| 17675 | 15216 | else temp_combo.usrflags &= ~cflag8; | |
| 17676 | 15216 | temp_combo.usrflags &= ~cflag7; | |
| 17677 | 15216 | break; | |
| 17678 | } | ||
| 17679 |
2/2✓ Branch 0 taken 751 times.
✓ Branch 1 taken 7438964 times.
|
7439715 | switch(temp_combo.type) |
| 17680 | { | ||
| 17681 | case cCHEST: case cLOCKEDCHEST: case cBOSSCHEST: | ||
| 17682 | 751 | temp_combo.attrishorts[2] = -1; | |
| 17683 | 751 | temp_combo.usrflags |= cflag7; | |
| 17684 | 751 | break; | |
| 17685 | } | ||
| 17686 | 7439715 | } | |
| 17687 |
2/2✓ Branch 0 taken 202968 times.
✓ Branch 1 taken 7236747 times.
|
7439715 | if(section_version < 20) |
| 17688 | { | ||
| 17689 | 7236747 | temp_combo.genflags = 0; | |
| 17690 |
2/2✓ Branch 0 taken 141882 times.
✓ Branch 1 taken 7094865 times.
|
7236747 | switch(temp_combo.type) |
| 17691 | { | ||
| 17692 | case cPUSH_WAIT: case cPUSH_HEAVY: | ||
| 17693 | case cPUSH_HW: case cL_STATUE: | ||
| 17694 | case cR_STATUE: case cPUSH_HEAVY2: | ||
| 17695 | case cPUSH_HW2: case cPOUND: | ||
| 17696 | case cC_STATUE: case cMIRROR: | ||
| 17697 | case cMIRRORSLASH: case cMIRRORBACKSLASH: | ||
| 17698 | case cMAGICPRISM: case cMAGICPRISM4: | ||
| 17699 | case cMAGICSPONGE: case cEYEBALL_A: | ||
| 17700 | case cEYEBALL_B: case cEYEBALL_4: | ||
| 17701 | case cBUSH: case cFLOWERS: | ||
| 17702 | case cLOCKBLOCK: case cLOCKBLOCK2: | ||
| 17703 | case cBOSSLOCKBLOCK: case cBOSSLOCKBLOCK2: | ||
| 17704 | case cCHEST: case cCHEST2: | ||
| 17705 | case cLOCKEDCHEST: case cLOCKEDCHEST2: | ||
| 17706 | case cBOSSCHEST: case cBOSSCHEST2: | ||
| 17707 | case cBUSHNEXT: case cBUSHTOUCHY: | ||
| 17708 | case cFLOWERSTOUCHY: case cBUSHNEXTTOUCHY: | ||
| 17709 | case cSIGNPOST: case cCSWITCHBLOCK: | ||
| 17710 | case cTORCH: case cTRIGGERGENERIC: | ||
| 17711 |
1/2✓ Branch 0 taken 141882 times.
✗ Branch 1 not taken.
|
141882 | if(temp_combo.usrflags & cflag16) |
| 17712 | { | ||
| 17713 | ✗ | temp_combo.genflags |= cflag1; | |
| 17714 | ✗ | temp_combo.usrflags &= ~cflag16; | |
| 17715 | ✗ | } | |
| 17716 | 141882 | break; | |
| 17717 | } | ||
| 17718 | 7236747 | } | |
| 17719 | |||
| 17720 | 7439715 | update_combo(temp_combo, section_version); | |
| 17721 | |||
| 17722 |
3/4✓ Branch 0 taken 7439715 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7424796 times.
✓ Branch 3 taken 14919 times.
|
7439715 | if(i>=start_combo && !should_skip) |
| 17723 | { | ||
| 17724 |
1/2✓ Branch 0 taken 7424796 times.
✗ Branch 1 not taken.
|
7424796 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 17725 | { | ||
| 17726 | ✗ | temp_combo.script = 0; | |
| 17727 | ✗ | for(int q = 0; q < 8; ++q) | |
| 17728 | ✗ | temp_combo.initd[q] = 0; | |
| 17729 | ✗ | } | |
| 17730 |
1/2✓ Branch 0 taken 7424796 times.
✗ Branch 1 not taken.
|
7424796 | combobuf[i] = temp_combo; |
| 17731 | 7424796 | } | |
| 17732 | 7439715 | } | |
| 17733 | |||
| 17734 |
2/2✓ Branch 0 taken 276 times.
✓ Branch 1 taken 1 times.
|
277 | if (should_skip) |
| 17735 | 1 | return 0; | |
| 17736 | |||
| 17737 |
5/6✓ Branch 0 taken 258 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 253 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
276 | if((version < 0x192)|| ((version == 0x192)&&(build<185))) |
| 17738 | { | ||
| 17739 |
2/2✓ Branch 0 taken 1501440 times.
✓ Branch 1 taken 23 times.
|
1501463 | for(int32_t tmpcounter=0; tmpcounter<MAXCOMBOS; tmpcounter++) |
| 17740 | { | ||
| 17741 |
2/2✓ Branch 0 taken 1501225 times.
✓ Branch 1 taken 215 times.
|
1501440 | if(combobuf[tmpcounter].type==cHOOKSHOTONLY) |
| 17742 | { | ||
| 17743 | 215 | combobuf[tmpcounter].type=cLADDERHOOKSHOT; | |
| 17744 | 215 | } | |
| 17745 | 1501440 | } | |
| 17746 | 23 | } | |
| 17747 | |||
| 17748 | //June 3 2012; ladder only is broken in 2.10 and allows the hookshot also. -Gleeok | ||
| 17749 |
4/6✓ Branch 0 taken 59 times.
✓ Branch 1 taken 217 times.
✓ Branch 2 taken 59 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 59 times.
|
276 | if(version == 0x210 && get_app_id() != App::zquest) |
| 17750 | { | ||
| 17751 |
2/2✓ Branch 0 taken 3851520 times.
✓ Branch 1 taken 59 times.
|
3851579 | for(int32_t tmpcounter=0; tmpcounter<MAXCOMBOS; tmpcounter++) |
| 17752 |
2/2✓ Branch 0 taken 3851335 times.
✓ Branch 1 taken 185 times.
|
3851705 | if(combobuf[tmpcounter].type == cLADDERONLY) |
| 17753 | 185 | combobuf[tmpcounter].type = cLADDERHOOKSHOT; | |
| 17754 | 59 | } | |
| 17755 | |||
| 17756 |
2/2✓ Branch 0 taken 194 times.
✓ Branch 1 taken 82 times.
|
276 | if(section_version<7) |
| 17757 | { | ||
| 17758 |
2/2✓ Branch 0 taken 5352960 times.
✓ Branch 1 taken 82 times.
|
5353042 | for(int32_t tmpcounter=0; tmpcounter<MAXCOMBOS; tmpcounter++) |
| 17759 | { | ||
| 17760 |
6/9✓ Branch 0 taken 5350008 times.
✓ Branch 1 taken 853 times.
✓ Branch 2 taken 791 times.
✓ Branch 3 taken 603 times.
✓ Branch 4 taken 174 times.
✓ Branch 5 taken 531 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
5352960 | switch(combobuf[tmpcounter].type) |
| 17761 | { | ||
| 17762 | case cSLASH: | ||
| 17763 | 853 | combobuf[tmpcounter].type=cSLASHTOUCHY; | |
| 17764 | 853 | break; | |
| 17765 | |||
| 17766 | case cSLASHITEM: | ||
| 17767 | 791 | combobuf[tmpcounter].type=cSLASHITEMTOUCHY; | |
| 17768 | 791 | break; | |
| 17769 | |||
| 17770 | case cBUSH: | ||
| 17771 | 603 | combobuf[tmpcounter].type=cBUSHTOUCHY; | |
| 17772 | 603 | break; | |
| 17773 | |||
| 17774 | case cFLOWERS: | ||
| 17775 | 174 | combobuf[tmpcounter].type=cFLOWERSTOUCHY; | |
| 17776 | 174 | break; | |
| 17777 | |||
| 17778 | case cTALLGRASS: | ||
| 17779 | 531 | combobuf[tmpcounter].type=cTALLGRASSTOUCHY; | |
| 17780 | 531 | break; | |
| 17781 | |||
| 17782 | case cSLASHNEXT: | ||
| 17783 | ✗ | combobuf[tmpcounter].type=cSLASHNEXTTOUCHY; | |
| 17784 | ✗ | break; | |
| 17785 | |||
| 17786 | case cSLASHNEXTITEM: | ||
| 17787 | ✗ | combobuf[tmpcounter].type=cSLASHNEXTITEMTOUCHY; | |
| 17788 | ✗ | break; | |
| 17789 | |||
| 17790 | case cBUSHNEXT: | ||
| 17791 | ✗ | combobuf[tmpcounter].type=cBUSHNEXTTOUCHY; | |
| 17792 | ✗ | break; | |
| 17793 | } | ||
| 17794 | 5352960 | } | |
| 17795 | 82 | } | |
| 17796 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 271 times.
|
276 | if (section_version < 16) |
| 17797 | { | ||
| 17798 |
2/2✓ Branch 0 taken 17690880 times.
✓ Branch 1 taken 271 times.
|
17691151 | for(int32_t tmpcounter=0; tmpcounter<MAXCOMBOS; tmpcounter++) |
| 17799 | { | ||
| 17800 |
2/2✓ Branch 0 taken 17662235 times.
✓ Branch 1 taken 28645 times.
|
17690880 | if (combobuf[tmpcounter].type == cWATER) |
| 17801 | { | ||
| 17802 | 28645 | combobuf[tmpcounter].attributes[0] = 40000L; | |
| 17803 | 28645 | } | |
| 17804 | 17690880 | } | |
| 17805 | 271 | } | |
| 17806 |
2/2✓ Branch 0 taken 273 times.
✓ Branch 1 taken 3 times.
|
276 | if(!get_qr(qr_ALLOW_EDITING_COMBO_0)) |
| 17807 | { | ||
| 17808 | 3 | combobuf[0].walk = 0xF0; | |
| 17809 | 3 | combobuf[0].type = 0; | |
| 17810 | 3 | combobuf[0].flag = 0; | |
| 17811 | 3 | } | |
| 17812 | |||
| 17813 | //Now for the new combo alias reset | ||
| 17814 |
2/2✓ Branch 0 taken 194 times.
✓ Branch 1 taken 82 times.
|
276 | if(section_version<2) |
| 17815 | { | ||
| 17816 |
2/2✓ Branch 0 taken 671744 times.
✓ Branch 1 taken 82 times.
|
671826 | for(int32_t j=0; j<MAXCOMBOALIASES; j++) |
| 17817 | { | ||
| 17818 | 671744 | combo_aliases[j].width = 0; | |
| 17819 | 671744 | combo_aliases[j].height = 0; | |
| 17820 | 671744 | combo_aliases[j].layermask = 0; | |
| 17821 |
1/2✓ Branch 0 taken 671744 times.
✗ Branch 1 not taken.
|
671744 | combo_aliases[j].combos.clear(); |
| 17822 |
1/2✓ Branch 0 taken 671744 times.
✗ Branch 1 not taken.
|
671744 | combo_aliases[j].csets.clear(); |
| 17823 | 671744 | } | |
| 17824 | 82 | } | |
| 17825 | |||
| 17826 | |||
| 17827 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | setup_combo_animations(); |
| 17828 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | setup_combo_animations2(); |
| 17829 | 276 | return 0; | |
| 17830 | 277 | } | |
| 17831 | 977581 | int32_t readcombo_loop(PACKFILE* f, word s_version, newcombo& temp_combo) | |
| 17832 | { | ||
| 17833 | byte combo_has_flags; | ||
| 17834 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 977581 times.
|
977581 | if(!p_getc(&combo_has_flags,f)) |
| 17835 | ✗ | return qe_invalid; | |
| 17836 | |||
| 17837 | 977581 | temp_combo.clear(); | |
| 17838 |
2/2✓ Branch 0 taken 602552 times.
✓ Branch 1 taken 375029 times.
|
977581 | if(combo_has_flags) |
| 17839 | { | ||
| 17840 |
2/2✓ Branch 0 taken 57 times.
✓ Branch 1 taken 374972 times.
|
375029 | if(combo_has_flags&CHAS_BASIC) |
| 17841 | { | ||
| 17842 |
1/2✓ Branch 0 taken 374972 times.
✗ Branch 1 not taken.
|
374972 | if(!p_igetl(&temp_combo.tile,f)) |
| 17843 | ✗ | return qe_invalid; | |
| 17844 | 374972 | temp_combo.o_tile = temp_combo.tile; | |
| 17845 | |||
| 17846 |
1/2✓ Branch 0 taken 374972 times.
✗ Branch 1 not taken.
|
374972 | if(!p_getc(&temp_combo.flip,f)) |
| 17847 | ✗ | return qe_invalid; | |
| 17848 | |||
| 17849 |
1/2✓ Branch 0 taken 374972 times.
✗ Branch 1 not taken.
|
374972 | if(!p_getc(&temp_combo.walk,f)) |
| 17850 | ✗ | return qe_invalid; | |
| 17851 | |||
| 17852 |
1/2✓ Branch 0 taken 374972 times.
✗ Branch 1 not taken.
|
374972 | if(!p_getc(&temp_combo.type,f)) |
| 17853 | ✗ | return qe_invalid; | |
| 17854 | |||
| 17855 |
1/2✓ Branch 0 taken 374972 times.
✗ Branch 1 not taken.
|
374972 | if(!p_getc(&temp_combo.flag,f)) |
| 17856 | ✗ | return qe_invalid; | |
| 17857 | |||
| 17858 |
1/2✓ Branch 0 taken 374972 times.
✗ Branch 1 not taken.
|
374972 | if(!p_getc(&temp_combo.csets,f)) |
| 17859 | ✗ | return qe_invalid; | |
| 17860 | 374972 | } | |
| 17861 |
2/2✓ Branch 0 taken 372489 times.
✓ Branch 1 taken 2540 times.
|
375029 | if(combo_has_flags&CHAS_SCRIPT) |
| 17862 | { | ||
| 17863 |
2/2✓ Branch 0 taken 2510 times.
✓ Branch 1 taken 30 times.
|
2540 | if (s_version>=41) |
| 17864 | { | ||
| 17865 | 2510 | p_getcstr(&temp_combo.label, f); | |
| 17866 | 2510 | } | |
| 17867 | else | ||
| 17868 | { | ||
| 17869 | char label[12]; | ||
| 17870 | 30 | label[11] = '\0'; | |
| 17871 |
2/2✓ Branch 0 taken 330 times.
✓ Branch 1 taken 30 times.
|
360 | for ( int32_t q = 0; q < 11; q++ ) |
| 17872 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 330 times.
|
330 | if(!p_getc(&label[q],f)) |
| 17873 | ✗ | return qe_invalid; | |
| 17874 | 30 | temp_combo.label = label; | |
| 17875 | } | ||
| 17876 | |||
| 17877 |
1/2✓ Branch 0 taken 2540 times.
✗ Branch 1 not taken.
|
2540 | if(!p_igetw(&temp_combo.script,f)) return qe_invalid; |
| 17878 | 2540 | auto initd_count = s_version >= 43 ? 8 : 2; | |
| 17879 |
2/2✓ Branch 0 taken 20140 times.
✓ Branch 1 taken 2540 times.
|
22680 | for ( int32_t q = 0; q < initd_count; q++ ) |
| 17880 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20140 times.
|
20140 | if(!p_igetl(&temp_combo.initd[q],f)) |
| 17881 | ✗ | return qe_invalid; | |
| 17882 | 2540 | } | |
| 17883 |
2/2✓ Branch 0 taken 291459 times.
✓ Branch 1 taken 83570 times.
|
375029 | if(combo_has_flags&CHAS_ANIM) |
| 17884 | { | ||
| 17885 |
1/2✓ Branch 0 taken 83570 times.
✗ Branch 1 not taken.
|
83570 | if(!p_getc(&temp_combo.frames,f)) |
| 17886 | ✗ | return qe_invalid; | |
| 17887 | |||
| 17888 |
1/2✓ Branch 0 taken 83570 times.
✗ Branch 1 not taken.
|
83570 | if(!p_getc(&temp_combo.speed,f)) |
| 17889 | ✗ | return qe_invalid; | |
| 17890 | |||
| 17891 |
1/2✓ Branch 0 taken 83570 times.
✗ Branch 1 not taken.
|
83570 | if(!p_igetw(&temp_combo.nextcombo,f)) |
| 17892 | ✗ | return qe_invalid; | |
| 17893 | |||
| 17894 |
1/2✓ Branch 0 taken 83570 times.
✗ Branch 1 not taken.
|
83570 | if(!p_getc(&temp_combo.nextcset,f)) |
| 17895 | ✗ | return qe_invalid; | |
| 17896 | |||
| 17897 |
1/2✓ Branch 0 taken 83570 times.
✗ Branch 1 not taken.
|
83570 | if(!p_getc(&temp_combo.skipanim,f)) |
| 17898 | ✗ | return qe_invalid; | |
| 17899 | |||
| 17900 |
1/2✓ Branch 0 taken 83570 times.
✗ Branch 1 not taken.
|
83570 | if(!p_getc(&temp_combo.skipanimy,f)) |
| 17901 | ✗ | return qe_invalid; | |
| 17902 | |||
| 17903 |
1/2✓ Branch 0 taken 83570 times.
✗ Branch 1 not taken.
|
83570 | if(!p_getc(&temp_combo.animflags,f)) |
| 17904 | ✗ | return qe_invalid; | |
| 17905 | 83570 | } | |
| 17906 |
2/2✓ Branch 0 taken 331302 times.
✓ Branch 1 taken 43727 times.
|
375029 | if(combo_has_flags&CHAS_ATTRIB) |
| 17907 | { | ||
| 17908 |
2/2✓ Branch 0 taken 174908 times.
✓ Branch 1 taken 43727 times.
|
218635 | for ( int32_t q = 0; q < 4; q++ ) |
| 17909 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 174908 times.
|
174908 | if(!p_igetl(&temp_combo.attributes[q],f)) |
| 17910 | ✗ | return qe_invalid; | |
| 17911 |
2/2✓ Branch 0 taken 349816 times.
✓ Branch 1 taken 43727 times.
|
393543 | for ( int32_t q = 0; q < 8; q++ ) |
| 17912 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 349816 times.
|
349816 | if(!p_getc(&temp_combo.attribytes[q],f)) |
| 17913 | ✗ | return qe_invalid; | |
| 17914 |
2/2✓ Branch 0 taken 349816 times.
✓ Branch 1 taken 43727 times.
|
393543 | for ( int32_t q = 0; q < 8; q++ ) |
| 17915 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 349816 times.
|
349816 | if(!p_igetw(&temp_combo.attrishorts[q],f)) |
| 17916 | ✗ | return qe_invalid; | |
| 17917 | 43727 | } | |
| 17918 |
2/2✓ Branch 0 taken 365825 times.
✓ Branch 1 taken 9204 times.
|
375029 | if(combo_has_flags&CHAS_FLAG) |
| 17919 | { | ||
| 17920 |
1/2✓ Branch 0 taken 9204 times.
✗ Branch 1 not taken.
|
9204 | if(!p_igetl(&temp_combo.usrflags,f)) |
| 17921 | ✗ | return qe_invalid; | |
| 17922 |
1/2✓ Branch 0 taken 9204 times.
✗ Branch 1 not taken.
|
9204 | if(!p_igetw(&temp_combo.genflags,f)) |
| 17923 | ✗ | return qe_invalid; | |
| 17924 | 9204 | } | |
| 17925 |
2/2✓ Branch 0 taken 364109 times.
✓ Branch 1 taken 10920 times.
|
375029 | if(combo_has_flags&CHAS_TRIG) |
| 17926 | { | ||
| 17927 | 10920 | int numtrigs = s_version < 36 ? 3 : 6; | |
| 17928 |
2/2✓ Branch 0 taken 64662 times.
✓ Branch 1 taken 10920 times.
|
75582 | for ( int32_t q = 0; q < numtrigs; q++ ) |
| 17929 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 64662 times.
|
64662 | if(!p_igetl(&temp_combo.triggerflags[q],f)) |
| 17930 | ✗ | return qe_invalid; | |
| 17931 |
1/2✓ Branch 0 taken 10920 times.
✗ Branch 1 not taken.
|
10920 | if(!p_igetl(&temp_combo.triggerlevel,f)) |
| 17932 | ✗ | return qe_invalid; | |
| 17933 |
1/2✓ Branch 0 taken 10920 times.
✗ Branch 1 not taken.
|
10920 | if(!p_getc(&temp_combo.triggerbtn,f)) |
| 17934 | ✗ | return qe_invalid; | |
| 17935 |
1/2✓ Branch 0 taken 10920 times.
✗ Branch 1 not taken.
|
10920 | if(!p_getc(&temp_combo.triggeritem,f)) |
| 17936 | ✗ | return qe_invalid; | |
| 17937 |
1/2✓ Branch 0 taken 10920 times.
✗ Branch 1 not taken.
|
10920 | if(!p_getc(&temp_combo.trigtimer,f)) |
| 17938 | ✗ | return qe_invalid; | |
| 17939 |
1/2✓ Branch 0 taken 10920 times.
✗ Branch 1 not taken.
|
10920 | if(!p_getc(&temp_combo.trigsfx,f)) |
| 17940 | ✗ | return qe_invalid; | |
| 17941 |
1/2✓ Branch 0 taken 10920 times.
✗ Branch 1 not taken.
|
10920 | if(!p_igetl(&temp_combo.trigchange,f)) |
| 17942 | ✗ | return qe_invalid; | |
| 17943 |
1/2✓ Branch 0 taken 10920 times.
✗ Branch 1 not taken.
|
10920 | if(!p_igetw(&temp_combo.trigprox,f)) |
| 17944 | ✗ | return qe_invalid; | |
| 17945 |
1/2✓ Branch 0 taken 10920 times.
✗ Branch 1 not taken.
|
10920 | if(!p_getc(&temp_combo.trigctr,f)) |
| 17946 | ✗ | return qe_invalid; | |
| 17947 |
1/2✓ Branch 0 taken 10920 times.
✗ Branch 1 not taken.
|
10920 | if(!p_igetl(&temp_combo.trigctramnt,f)) |
| 17948 | ✗ | return qe_invalid; | |
| 17949 |
1/2✓ Branch 0 taken 10920 times.
✗ Branch 1 not taken.
|
10920 | if(!p_getc(&temp_combo.triglbeam,f)) |
| 17950 | ✗ | return qe_invalid; | |
| 17951 |
1/2✓ Branch 0 taken 10920 times.
✗ Branch 1 not taken.
|
10920 | if(!p_getc(&temp_combo.trigcschange,f)) |
| 17952 | ✗ | return qe_invalid; | |
| 17953 |
1/2✓ Branch 0 taken 10920 times.
✗ Branch 1 not taken.
|
10920 | if(!p_igetw(&temp_combo.spawnitem,f)) |
| 17954 | ✗ | return qe_invalid; | |
| 17955 |
1/2✓ Branch 0 taken 10920 times.
✗ Branch 1 not taken.
|
10920 | if(!p_igetw(&temp_combo.spawnenemy,f)) |
| 17956 | ✗ | return qe_invalid; | |
| 17957 |
1/2✓ Branch 0 taken 10920 times.
✗ Branch 1 not taken.
|
10920 | if(!p_getc(&temp_combo.exstate,f)) |
| 17958 | ✗ | return qe_invalid; | |
| 17959 |
1/2✓ Branch 0 taken 10920 times.
✗ Branch 1 not taken.
|
10920 | if(!p_igetl(&temp_combo.spawnip,f)) |
| 17960 | ✗ | return qe_invalid; | |
| 17961 |
1/2✓ Branch 0 taken 10920 times.
✗ Branch 1 not taken.
|
10920 | if(!p_getc(&temp_combo.trigcopycat,f)) |
| 17962 | ✗ | return qe_invalid; | |
| 17963 |
1/2✓ Branch 0 taken 10920 times.
✗ Branch 1 not taken.
|
10920 | if(!p_getc(&temp_combo.trigcooldown,f)) |
| 17964 | ✗ | return qe_invalid; | |
| 17965 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10920 times.
|
10920 | if(s_version >= 35) |
| 17966 | { | ||
| 17967 |
1/2✓ Branch 0 taken 10920 times.
✗ Branch 1 not taken.
|
10920 | if(!p_igetw(&temp_combo.prompt_cid,f)) |
| 17968 | ✗ | return qe_invalid; | |
| 17969 |
1/2✓ Branch 0 taken 10920 times.
✗ Branch 1 not taken.
|
10920 | if(!p_getc(&temp_combo.prompt_cs,f)) |
| 17970 | ✗ | return qe_invalid; | |
| 17971 |
1/2✓ Branch 0 taken 10920 times.
✗ Branch 1 not taken.
|
10920 | if(!p_igetw(&temp_combo.prompt_x,f)) |
| 17972 | ✗ | return qe_invalid; | |
| 17973 |
1/2✓ Branch 0 taken 10920 times.
✗ Branch 1 not taken.
|
10920 | if(!p_igetw(&temp_combo.prompt_y,f)) |
| 17974 | ✗ | return qe_invalid; | |
| 17975 | 10920 | } | |
| 17976 |
2/2✓ Branch 0 taken 286 times.
✓ Branch 1 taken 10634 times.
|
10920 | if(s_version >= 36) |
| 17977 | { | ||
| 17978 |
1/2✓ Branch 0 taken 10634 times.
✗ Branch 1 not taken.
|
10634 | if(!p_getc(&temp_combo.trig_lstate,f)) |
| 17979 | ✗ | return qe_invalid; | |
| 17980 |
1/2✓ Branch 0 taken 10634 times.
✗ Branch 1 not taken.
|
10634 | if(!p_getc(&temp_combo.trig_gstate,f)) |
| 17981 | ✗ | return qe_invalid; | |
| 17982 |
1/2✓ Branch 0 taken 10634 times.
✗ Branch 1 not taken.
|
10634 | if(!p_igetl(&temp_combo.trig_statetime,f)) |
| 17983 | ✗ | return qe_invalid; | |
| 17984 | 10634 | } | |
| 17985 |
2/2✓ Branch 0 taken 286 times.
✓ Branch 1 taken 10634 times.
|
10920 | if(s_version >= 37) |
| 17986 | { | ||
| 17987 |
1/2✓ Branch 0 taken 10634 times.
✗ Branch 1 not taken.
|
10634 | if(!p_igetw(&temp_combo.trig_genscr,f)) |
| 17988 | ✗ | return qe_invalid; | |
| 17989 | 10634 | } | |
| 17990 |
2/2✓ Branch 0 taken 434 times.
✓ Branch 1 taken 10486 times.
|
10920 | if(s_version >= 38) |
| 17991 | { | ||
| 17992 |
1/2✓ Branch 0 taken 10486 times.
✗ Branch 1 not taken.
|
10486 | if(!p_getc(&temp_combo.trig_group,f)) |
| 17993 | ✗ | return qe_invalid; | |
| 17994 |
1/2✓ Branch 0 taken 10486 times.
✗ Branch 1 not taken.
|
10486 | if(!p_igetw(&temp_combo.trig_group_val,f)) |
| 17995 | ✗ | return qe_invalid; | |
| 17996 | 10486 | } | |
| 17997 |
2/2✓ Branch 0 taken 470 times.
✓ Branch 1 taken 10450 times.
|
10920 | if(s_version >= 45) |
| 17998 | { | ||
| 17999 |
1/2✓ Branch 0 taken 10450 times.
✗ Branch 1 not taken.
|
10450 | if(!p_getc(&temp_combo.exdoor_dir,f)) |
| 18000 | ✗ | return qe_invalid; | |
| 18001 |
1/2✓ Branch 0 taken 10450 times.
✗ Branch 1 not taken.
|
10450 | if(!p_getc(&temp_combo.exdoor_ind,f)) |
| 18002 | ✗ | return qe_invalid; | |
| 18003 | 10450 | } | |
| 18004 |
2/2✓ Branch 0 taken 6961 times.
✓ Branch 1 taken 3959 times.
|
10920 | if(s_version >= 46) |
| 18005 | { | ||
| 18006 |
1/2✓ Branch 0 taken 3959 times.
✗ Branch 1 not taken.
|
3959 | if(!p_getc(&temp_combo.trig_levelitems,f)) |
| 18007 | ✗ | return qe_invalid; | |
| 18008 |
1/2✓ Branch 0 taken 3959 times.
✗ Branch 1 not taken.
|
3959 | if(!p_igetw(&temp_combo.trigdmlevel,f)) |
| 18009 | ✗ | return qe_invalid; | |
| 18010 |
1/2✓ Branch 0 taken 3959 times.
✗ Branch 1 not taken.
|
3959 | if(s_version >= 48) |
| 18011 | { | ||
| 18012 |
2/2✓ Branch 0 taken 11877 times.
✓ Branch 1 taken 3959 times.
|
15836 | for(int q = 0; q < 3; ++q) |
| 18013 |
1/2✓ Branch 0 taken 11877 times.
✗ Branch 1 not taken.
|
11877 | if(!p_igetw(&temp_combo.trigtint[q],f)) |
| 18014 | ✗ | return qe_invalid; | |
| 18015 | 3959 | } | |
| 18016 | else | ||
| 18017 | { | ||
| 18018 | ✗ | for(int q = 0; q < 3; ++q) | |
| 18019 | ✗ | if(!p_getc(&temp_combo.trigtint[q],f)) | |
| 18020 | ✗ | return qe_invalid; | |
| 18021 | ✗ | for(int q = 0; q < 3; ++q) | |
| 18022 | { | ||
| 18023 | ✗ | int v = temp_combo.trigtint[q]; | |
| 18024 | ✗ | int va = abs(v); | |
| 18025 | ✗ | temp_combo.trigtint[q] = _rgb_scale_6[va] * sign(v); | |
| 18026 | ✗ | } | |
| 18027 | } | ||
| 18028 |
1/2✓ Branch 0 taken 3959 times.
✗ Branch 1 not taken.
|
3959 | if(!p_igetw(&temp_combo.triglvlpalette,f)) |
| 18029 | ✗ | return qe_invalid; | |
| 18030 |
1/2✓ Branch 0 taken 3959 times.
✗ Branch 1 not taken.
|
3959 | if(!p_igetw(&temp_combo.trigbosspalette,f)) |
| 18031 | ✗ | return qe_invalid; | |
| 18032 |
1/2✓ Branch 0 taken 3959 times.
✗ Branch 1 not taken.
|
3959 | if(!p_igetw(&temp_combo.trigquaketime,f)) |
| 18033 | ✗ | return qe_invalid; | |
| 18034 |
1/2✓ Branch 0 taken 3959 times.
✗ Branch 1 not taken.
|
3959 | if(!p_igetw(&temp_combo.trigwavytime,f)) |
| 18035 | ✗ | return qe_invalid; | |
| 18036 |
1/2✓ Branch 0 taken 3959 times.
✗ Branch 1 not taken.
|
3959 | if(!p_igetw(&temp_combo.trig_swjinxtime,f)) |
| 18037 | ✗ | return qe_invalid; | |
| 18038 |
1/2✓ Branch 0 taken 3959 times.
✗ Branch 1 not taken.
|
3959 | if(!p_igetw(&temp_combo.trig_itmjinxtime,f)) |
| 18039 | ✗ | return qe_invalid; | |
| 18040 |
1/2✓ Branch 0 taken 3959 times.
✗ Branch 1 not taken.
|
3959 | if(!p_igetw(&temp_combo.trig_stuntime,f)) |
| 18041 | ✗ | return qe_invalid; | |
| 18042 |
1/2✓ Branch 0 taken 3959 times.
✗ Branch 1 not taken.
|
3959 | if(!p_igetw(&temp_combo.trig_bunnytime,f)) |
| 18043 | ✗ | return qe_invalid; | |
| 18044 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3959 times.
|
3959 | if(!p_getc(&temp_combo.trig_pushtime,f)) |
| 18045 | ✗ | return qe_invalid; | |
| 18046 | 3959 | } | |
| 18047 |
2/2✓ Branch 0 taken 6961 times.
✓ Branch 1 taken 3959 times.
|
10920 | if(s_version >= 47) |
| 18048 | { | ||
| 18049 |
1/2✓ Branch 0 taken 3959 times.
✗ Branch 1 not taken.
|
3959 | if (!p_igetw(&temp_combo.trig_shieldjinxtime, f)) |
| 18050 | ✗ | return qe_invalid; | |
| 18051 | 3959 | } | |
| 18052 | 10920 | } | |
| 18053 |
2/2✓ Branch 0 taken 374562 times.
✓ Branch 1 taken 467 times.
|
375029 | if(combo_has_flags&CHAS_LIFT) |
| 18054 | { | ||
| 18055 |
1/2✓ Branch 0 taken 467 times.
✗ Branch 1 not taken.
|
467 | if(!p_igetw(&temp_combo.liftcmb,f)) |
| 18056 | ✗ | return qe_invalid; | |
| 18057 |
1/2✓ Branch 0 taken 467 times.
✗ Branch 1 not taken.
|
467 | if(!p_getc(&temp_combo.liftcs,f)) |
| 18058 | ✗ | return qe_invalid; | |
| 18059 |
1/2✓ Branch 0 taken 467 times.
✗ Branch 1 not taken.
|
467 | if(!p_igetw(&temp_combo.liftundercmb,f)) |
| 18060 | ✗ | return qe_invalid; | |
| 18061 |
1/2✓ Branch 0 taken 467 times.
✗ Branch 1 not taken.
|
467 | if(!p_getc(&temp_combo.liftundercs,f)) |
| 18062 | ✗ | return qe_invalid; | |
| 18063 |
1/2✓ Branch 0 taken 467 times.
✗ Branch 1 not taken.
|
467 | if(!p_getc(&temp_combo.liftdmg,f)) |
| 18064 | ✗ | return qe_invalid; | |
| 18065 |
1/2✓ Branch 0 taken 467 times.
✗ Branch 1 not taken.
|
467 | if(!p_getc(&temp_combo.liftlvl,f)) |
| 18066 | ✗ | return qe_invalid; | |
| 18067 |
1/2✓ Branch 0 taken 467 times.
✗ Branch 1 not taken.
|
467 | if(!p_getc(&temp_combo.liftitm,f)) |
| 18068 | ✗ | return qe_invalid; | |
| 18069 |
1/2✓ Branch 0 taken 467 times.
✗ Branch 1 not taken.
|
467 | if(!p_getc(&temp_combo.liftflags,f)) |
| 18070 | ✗ | return qe_invalid; | |
| 18071 |
1/2✓ Branch 0 taken 467 times.
✗ Branch 1 not taken.
|
467 | if(!p_getc(&temp_combo.liftgfx,f)) |
| 18072 | ✗ | return qe_invalid; | |
| 18073 |
1/2✓ Branch 0 taken 467 times.
✗ Branch 1 not taken.
|
467 | if(!p_getc(&temp_combo.liftsprite,f)) |
| 18074 | ✗ | return qe_invalid; | |
| 18075 |
1/2✓ Branch 0 taken 467 times.
✗ Branch 1 not taken.
|
467 | if(!p_getc(&temp_combo.liftsfx,f)) |
| 18076 | ✗ | return qe_invalid; | |
| 18077 |
1/2✓ Branch 0 taken 467 times.
✗ Branch 1 not taken.
|
467 | if(!p_igetw(&temp_combo.liftbreaksprite,f)) |
| 18078 | ✗ | return qe_invalid; | |
| 18079 |
1/2✓ Branch 0 taken 467 times.
✗ Branch 1 not taken.
|
467 | if(!p_getc(&temp_combo.liftbreaksfx,f)) |
| 18080 | ✗ | return qe_invalid; | |
| 18081 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 467 times.
|
467 | if(s_version >= 34) |
| 18082 | { | ||
| 18083 |
1/2✓ Branch 0 taken 467 times.
✗ Branch 1 not taken.
|
467 | if(!p_getc(&temp_combo.lifthei,f)) |
| 18084 | ✗ | return qe_invalid; | |
| 18085 |
1/2✓ Branch 0 taken 467 times.
✗ Branch 1 not taken.
|
467 | if(!p_getc(&temp_combo.lifttime,f)) |
| 18086 | ✗ | return qe_invalid; | |
| 18087 | 467 | } | |
| 18088 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 453 times.
|
467 | if(s_version >= 39) |
| 18089 | { | ||
| 18090 |
1/2✓ Branch 0 taken 453 times.
✗ Branch 1 not taken.
|
453 | if(!p_getc(&temp_combo.lift_parent_item,f)) |
| 18091 | ✗ | return qe_invalid; | |
| 18092 | 453 | } | |
| 18093 | 467 | } | |
| 18094 |
2/2✓ Branch 0 taken 374287 times.
✓ Branch 1 taken 742 times.
|
375029 | if(combo_has_flags&CHAS_GENERAL) |
| 18095 | { | ||
| 18096 |
1/2✓ Branch 0 taken 742 times.
✗ Branch 1 not taken.
|
742 | if(!p_getc(&temp_combo.speed_mult,f)) |
| 18097 | ✗ | return qe_invalid; | |
| 18098 |
1/2✓ Branch 0 taken 742 times.
✗ Branch 1 not taken.
|
742 | if(!p_getc(&temp_combo.speed_div,f)) |
| 18099 | ✗ | return qe_invalid; | |
| 18100 |
1/2✓ Branch 0 taken 742 times.
✗ Branch 1 not taken.
|
742 | if(!p_igetzf(&temp_combo.speed_add,f)) |
| 18101 | ✗ | return qe_invalid; | |
| 18102 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 742 times.
|
742 | if(s_version >= 42) |
| 18103 | { | ||
| 18104 |
1/2✓ Branch 0 taken 742 times.
✗ Branch 1 not taken.
|
742 | if(!p_getc(&temp_combo.sfx_appear,f)) |
| 18105 | ✗ | return qe_invalid; | |
| 18106 |
1/2✓ Branch 0 taken 742 times.
✗ Branch 1 not taken.
|
742 | if(!p_getc(&temp_combo.sfx_disappear,f)) |
| 18107 | ✗ | return qe_invalid; | |
| 18108 |
1/2✓ Branch 0 taken 742 times.
✗ Branch 1 not taken.
|
742 | if(!p_getc(&temp_combo.sfx_loop,f)) |
| 18109 | ✗ | return qe_invalid; | |
| 18110 |
1/2✓ Branch 0 taken 742 times.
✗ Branch 1 not taken.
|
742 | if(!p_getc(&temp_combo.sfx_walking,f)) |
| 18111 | ✗ | return qe_invalid; | |
| 18112 |
1/2✓ Branch 0 taken 742 times.
✗ Branch 1 not taken.
|
742 | if(!p_getc(&temp_combo.sfx_standing,f)) |
| 18113 | ✗ | return qe_invalid; | |
| 18114 |
1/2✓ Branch 0 taken 742 times.
✗ Branch 1 not taken.
|
742 | if(!p_getc(&temp_combo.spr_appear,f)) |
| 18115 | ✗ | return qe_invalid; | |
| 18116 |
1/2✓ Branch 0 taken 742 times.
✗ Branch 1 not taken.
|
742 | if(!p_getc(&temp_combo.spr_disappear,f)) |
| 18117 | ✗ | return qe_invalid; | |
| 18118 |
1/2✓ Branch 0 taken 742 times.
✗ Branch 1 not taken.
|
742 | if(!p_getc(&temp_combo.spr_walking,f)) |
| 18119 | ✗ | return qe_invalid; | |
| 18120 |
1/2✓ Branch 0 taken 742 times.
✗ Branch 1 not taken.
|
742 | if(!p_getc(&temp_combo.spr_standing,f)) |
| 18121 | ✗ | return qe_invalid; | |
| 18122 | 742 | } | |
| 18123 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 742 times.
|
742 | if(s_version >= 44) |
| 18124 | { | ||
| 18125 |
1/2✓ Branch 0 taken 742 times.
✗ Branch 1 not taken.
|
742 | if(!p_getc(&temp_combo.sfx_tap,f)) |
| 18126 | ✗ | return qe_invalid; | |
| 18127 | 742 | } | |
| 18128 | 742 | } | |
| 18129 | 375029 | } | |
| 18130 | 977581 | update_combo(temp_combo, s_version); | |
| 18131 | 977581 | return 0; | |
| 18132 | 977581 | } | |
| 18133 | 415 | int32_t readcombos(PACKFILE *f, zquestheader *Header, word version, word build, word start_combo, word max_combos) | |
| 18134 | { | ||
| 18135 |
2/2✓ Branch 0 taken 391 times.
✓ Branch 1 taken 24 times.
|
415 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_combos); |
| 18136 | |||
| 18137 | 415 | word section_version=0; | |
| 18138 | 415 | word section_cversion=0; | |
| 18139 | 415 | word combos_used=0; | |
| 18140 | int32_t dummy; | ||
| 18141 | byte padding; | ||
| 18142 | 415 | newcombo temp_combo; | |
| 18143 | |||
| 18144 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 414 times.
|
415 | if (!should_skip) |
| 18145 | { | ||
| 18146 |
1/2✓ Branch 0 taken 414 times.
✗ Branch 1 not taken.
|
414 | reset_combo_animations(); |
| 18147 |
1/2✓ Branch 0 taken 414 times.
✗ Branch 1 not taken.
|
414 | reset_combo_animations2(); |
| 18148 |
1/2✓ Branch 0 taken 414 times.
✗ Branch 1 not taken.
|
414 | init_combo_classes(); |
| 18149 | |||
| 18150 |
2/2✓ Branch 0 taken 27025920 times.
✓ Branch 1 taken 414 times.
|
27026334 | for(int32_t q = start_combo; q < start_combo+max_combos; ++q) |
| 18151 |
1/2✓ Branch 0 taken 27025920 times.
✗ Branch 1 not taken.
|
27025920 | combobuf[q].clear(); |
| 18152 | 414 | } | |
| 18153 | |||
| 18154 |
2/2✓ Branch 0 taken 391 times.
✓ Branch 1 taken 24 times.
|
415 | if(version > 0x192) //Version info |
| 18155 | { | ||
| 18156 |
2/4✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 391 times.
✗ Branch 3 not taken.
|
391 | if(!p_igetw(§ion_version,f)) |
| 18157 | { | ||
| 18158 | ✗ | return qe_invalid; | |
| 18159 | } | ||
| 18160 | 391 | FFCore.quest_format[vCombos] = section_version; | |
| 18161 |
2/4✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 391 times.
✗ Branch 3 not taken.
|
391 | if(!p_igetw(§ion_cversion,f)) |
| 18162 | { | ||
| 18163 | ✗ | return qe_invalid; | |
| 18164 | } | ||
| 18165 | |||
| 18166 | //section size | ||
| 18167 |
2/4✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 391 times.
✗ Branch 3 not taken.
|
391 | if(!p_igetl(&dummy,f)) |
| 18168 | { | ||
| 18169 | ✗ | return qe_invalid; | |
| 18170 | } | ||
| 18171 | 391 | } | |
| 18172 | |||
| 18173 |
2/2✓ Branch 0 taken 138 times.
✓ Branch 1 taken 277 times.
|
415 | if(section_version > 32) //Cleanup time! |
| 18174 | { | ||
| 18175 |
2/4✓ Branch 0 taken 138 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 138 times.
✗ Branch 3 not taken.
|
138 | if(!p_igetw(&combos_used,f)) |
| 18176 | { | ||
| 18177 | ✗ | return qe_invalid; | |
| 18178 | } | ||
| 18179 |
2/2✓ Branch 0 taken 977581 times.
✓ Branch 1 taken 138 times.
|
977719 | for(int32_t i=0; i<combos_used; i++) |
| 18180 | { | ||
| 18181 |
1/2✓ Branch 0 taken 977581 times.
✗ Branch 1 not taken.
|
977581 | auto ret = readcombo_loop(f,section_version,temp_combo); |
| 18182 |
1/2✓ Branch 0 taken 977581 times.
✗ Branch 1 not taken.
|
977581 | if(ret) return ret; |
| 18183 |
1/2✓ Branch 0 taken 977581 times.
✗ Branch 1 not taken.
|
977581 | if(i>=start_combo) |
| 18184 | { | ||
| 18185 |
1/2✓ Branch 0 taken 977581 times.
✗ Branch 1 not taken.
|
977581 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 18186 | { | ||
| 18187 | ✗ | temp_combo.script = 0; | |
| 18188 | ✗ | for(int q = 0; q < 8; ++q) | |
| 18189 | ✗ | temp_combo.initd[q] = 0; | |
| 18190 | ✗ | } | |
| 18191 |
1/2✓ Branch 0 taken 977581 times.
✗ Branch 1 not taken.
|
977581 | combobuf[i] = temp_combo; |
| 18192 | 977581 | } | |
| 18193 | 977581 | } | |
| 18194 | 138 | } | |
| 18195 | else //Call the old function for all old versions | ||
| 18196 | { | ||
| 18197 |
1/2✓ Branch 0 taken 277 times.
✗ Branch 1 not taken.
|
277 | auto ret = readcombos_old(section_version,f,Header,version,build,start_combo,max_combos); |
| 18198 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 277 times.
|
277 | if(ret) return ret; //error, end read |
| 18199 | } | ||
| 18200 | |||
| 18201 |
2/2✓ Branch 0 taken 414 times.
✓ Branch 1 taken 1 times.
|
415 | if (should_skip) |
| 18202 | 1 | return 0; | |
| 18203 | |||
| 18204 |
2/2✓ Branch 0 taken 283 times.
✓ Branch 1 taken 131 times.
|
414 | if(!get_qr(qr_ALLOW_EDITING_COMBO_0)) |
| 18205 | { | ||
| 18206 | 131 | combobuf[0].walk = 0xF0; | |
| 18207 | 131 | combobuf[0].type = 0; | |
| 18208 | 131 | combobuf[0].flag = 0; | |
| 18209 | 131 | } | |
| 18210 | |||
| 18211 |
1/2✓ Branch 0 taken 414 times.
✗ Branch 1 not taken.
|
414 | setup_combo_animations(); |
| 18212 |
1/2✓ Branch 0 taken 414 times.
✗ Branch 1 not taken.
|
414 | setup_combo_animations2(); |
| 18213 | 414 | return 0; | |
| 18214 | 415 | } | |
| 18215 | |||
| 18216 | 332 | int32_t readcomboaliases(PACKFILE *f, zquestheader *Header, word version, word build) | |
| 18217 | { | ||
| 18218 | //these are here to bypass compiler warnings about unused arguments | ||
| 18219 | 332 | Header=Header; | |
| 18220 | 332 | version=version; | |
| 18221 | 332 | build=build; | |
| 18222 | |||
| 18223 | int32_t dummy; | ||
| 18224 | 332 | word sversion=0, c_sversion; | |
| 18225 | |||
| 18226 | //section version info | ||
| 18227 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | if(!p_igetw(&sversion,f)) |
| 18228 | { | ||
| 18229 | ✗ | return qe_invalid; | |
| 18230 | } | ||
| 18231 | |||
| 18232 | 332 | FFCore.quest_format[vComboAliases] = sversion; | |
| 18233 | |||
| 18234 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_igetw(&c_sversion,f)) |
| 18235 | { | ||
| 18236 | ✗ | return qe_invalid; | |
| 18237 | } | ||
| 18238 | |||
| 18239 | //section size | ||
| 18240 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_igetl(&dummy,f)) |
| 18241 | { | ||
| 18242 | ✗ | return qe_invalid; | |
| 18243 | } | ||
| 18244 | |||
| 18245 | 332 | int32_t max_num_combo_aliases = MAXCOMBOALIASES; | |
| 18246 | |||
| 18247 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 189 times.
|
332 | if(sversion < 3) // max saved combo alias' upped from 256 to 2048. |
| 18248 | { | ||
| 18249 | 189 | max_num_combo_aliases = MAX250COMBOALIASES; | |
| 18250 | 189 | } | |
| 18251 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(sversion < 2) // max saved combo alias' upped from 256 to 2048. |
| 18252 | { | ||
| 18253 | ✗ | max_num_combo_aliases = OLDMAXCOMBOALIASES; | |
| 18254 | ✗ | } | |
| 18255 | |||
| 18256 |
2/2✓ Branch 0 taken 1558528 times.
✓ Branch 1 taken 332 times.
|
1558860 | for(int32_t j=0; j<max_num_combo_aliases; j++) |
| 18257 | { | ||
| 18258 | byte width,height,mask,tempcset; | ||
| 18259 | int32_t count; | ||
| 18260 | word tempword; | ||
| 18261 | byte tempbyte; | ||
| 18262 | |||
| 18263 |
1/2✓ Branch 0 taken 1558528 times.
✗ Branch 1 not taken.
|
1558528 | if(!p_igetw(&tempword,f)) |
| 18264 | { | ||
| 18265 | ✗ | return qe_invalid; | |
| 18266 | } | ||
| 18267 | |||
| 18268 | 1558528 | combo_aliases[j].combo = tempword; | |
| 18269 | |||
| 18270 |
1/2✓ Branch 0 taken 1558528 times.
✗ Branch 1 not taken.
|
1558528 | if(!p_getc(&tempbyte,f)) |
| 18271 | { | ||
| 18272 | ✗ | return qe_invalid; | |
| 18273 | } | ||
| 18274 | |||
| 18275 | 1558528 | combo_aliases[j].cset = tempbyte; | |
| 18276 | |||
| 18277 |
1/2✓ Branch 0 taken 1558528 times.
✗ Branch 1 not taken.
|
1558528 | if(!p_getc(&width,f)) |
| 18278 | { | ||
| 18279 | ✗ | return qe_invalid; | |
| 18280 | } | ||
| 18281 | |||
| 18282 |
1/2✓ Branch 0 taken 1558528 times.
✗ Branch 1 not taken.
|
1558528 | if(!p_getc(&height,f)) |
| 18283 | { | ||
| 18284 | ✗ | return qe_invalid; | |
| 18285 | } | ||
| 18286 | |||
| 18287 |
1/2✓ Branch 0 taken 1558528 times.
✗ Branch 1 not taken.
|
1558528 | if(!p_getc(&mask,f)) |
| 18288 | { | ||
| 18289 | ✗ | return qe_invalid; | |
| 18290 | } | ||
| 18291 | |||
| 18292 | 1558528 | count=(width+1)*(height+1)*(comboa_lmasktotal(mask)+1); | |
| 18293 | |||
| 18294 | 1558528 | combo_aliases[j].width = width; | |
| 18295 | 1558528 | combo_aliases[j].height = height; | |
| 18296 | 1558528 | combo_aliases[j].layermask = mask; | |
| 18297 | 1558528 | combo_aliases[j].combos.clear(); | |
| 18298 | 1558528 | combo_aliases[j].csets.clear(); | |
| 18299 | |||
| 18300 |
2/2✓ Branch 0 taken 1597504 times.
✓ Branch 1 taken 1558528 times.
|
3156032 | for(int32_t k=0; k<count; k++) |
| 18301 | { | ||
| 18302 |
1/2✓ Branch 0 taken 1597504 times.
✗ Branch 1 not taken.
|
1597504 | if(!p_igetw(&tempword,f)) |
| 18303 | { | ||
| 18304 | ✗ | return qe_invalid; | |
| 18305 | } | ||
| 18306 | |||
| 18307 | 1597504 | combo_aliases[j].combos[k] = tempword; | |
| 18308 | 1597504 | } | |
| 18309 | |||
| 18310 |
2/2✓ Branch 0 taken 1597504 times.
✓ Branch 1 taken 1558528 times.
|
3156032 | for(int32_t k=0; k<count; k++) |
| 18311 | { | ||
| 18312 |
1/2✓ Branch 0 taken 1597504 times.
✗ Branch 1 not taken.
|
1597504 | if(!p_getc(&tempcset,f)) |
| 18313 | { | ||
| 18314 | ✗ | return qe_invalid; | |
| 18315 | } | ||
| 18316 | |||
| 18317 | 1597504 | combo_aliases[j].csets[k] = tempcset; | |
| 18318 | 1597504 | } | |
| 18319 | 1558528 | } | |
| 18320 | |||
| 18321 | //Combo pools! | ||
| 18322 | 332 | word num_combo_pools = 0; | |
| 18323 |
2/2✓ Branch 0 taken 194 times.
✓ Branch 1 taken 138 times.
|
332 | if(sversion >= 4) |
| 18324 | { | ||
| 18325 |
1/2✓ Branch 0 taken 138 times.
✗ Branch 1 not taken.
|
138 | if(!p_igetw(&num_combo_pools,f)) |
| 18326 | { | ||
| 18327 | ✗ | return qe_invalid; | |
| 18328 | } | ||
| 18329 | 138 | } | |
| 18330 | |||
| 18331 |
2/2✓ Branch 0 taken 2719744 times.
✓ Branch 1 taken 332 times.
|
2720076 | for(combo_pool& pool : combo_pools) |
| 18332 | { | ||
| 18333 | 2719744 | pool.clear(); | |
| 18334 | } | ||
| 18335 | |||
| 18336 | 332 | combo_pool temp_cpool; | |
| 18337 |
2/2✓ Branch 0 taken 438 times.
✓ Branch 1 taken 332 times.
|
770 | for(word cp = 0; cp < num_combo_pools; ++cp) |
| 18338 | { | ||
| 18339 | 438 | int32_t num_combos_in_pool = 0; | |
| 18340 |
2/4✓ Branch 0 taken 438 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 438 times.
✗ Branch 3 not taken.
|
438 | if(!p_igetl(&num_combos_in_pool,f)) |
| 18341 | { | ||
| 18342 | ✗ | return qe_invalid; | |
| 18343 | } | ||
| 18344 |
2/2✓ Branch 0 taken 342 times.
✓ Branch 1 taken 96 times.
|
438 | if(num_combos_in_pool < 1) continue; //nothing to read |
| 18345 | |||
| 18346 |
1/2✓ Branch 0 taken 342 times.
✗ Branch 1 not taken.
|
342 | temp_cpool.clear(); |
| 18347 | |||
| 18348 | int32_t cp_cid; int8_t cp_cs; word cp_quant; | ||
| 18349 |
2/2✓ Branch 0 taken 342 times.
✓ Branch 1 taken 1550 times.
|
1892 | for(auto q = 0; q < num_combos_in_pool; ++q) |
| 18350 | { | ||
| 18351 |
2/4✓ Branch 0 taken 1550 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1550 times.
✗ Branch 3 not taken.
|
1550 | if(!p_igetl(&cp_cid,f)) |
| 18352 | { | ||
| 18353 | ✗ | return qe_invalid; | |
| 18354 | } | ||
| 18355 |
2/4✓ Branch 0 taken 1550 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1550 times.
✗ Branch 3 not taken.
|
1550 | if(!p_getc(&cp_cs,f)) |
| 18356 | { | ||
| 18357 | ✗ | return qe_invalid; | |
| 18358 | } | ||
| 18359 |
2/4✓ Branch 0 taken 1550 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1550 times.
✗ Branch 3 not taken.
|
1550 | if(!p_igetw(&cp_quant,f)) |
| 18360 | { | ||
| 18361 | ✗ | return qe_invalid; | |
| 18362 | } | ||
| 18363 |
1/2✓ Branch 0 taken 1550 times.
✗ Branch 1 not taken.
|
1550 | temp_cpool.add(cp_cid, cp_cs, cp_quant); |
| 18364 | 1550 | } | |
| 18365 | |||
| 18366 |
1/2✓ Branch 0 taken 342 times.
✗ Branch 1 not taken.
|
342 | combo_pools[cp] = temp_cpool; |
| 18367 | 342 | } | |
| 18368 | |||
| 18369 | //Autocombos! | ||
| 18370 | 332 | word num_combo_autos = 0; | |
| 18371 |
2/2✓ Branch 0 taken 126 times.
✓ Branch 1 taken 206 times.
|
332 | if (sversion >= 5) |
| 18372 | { | ||
| 18373 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if (!p_igetw(&num_combo_autos, f)) |
| 18374 | { | ||
| 18375 | ✗ | return qe_invalid; | |
| 18376 | } | ||
| 18377 | 126 | } | |
| 18378 | |||
| 18379 |
2/2✓ Branch 0 taken 332 times.
✓ Branch 1 taken 2719744 times.
|
2720076 | for (combo_auto& cauto : combo_autos) |
| 18380 | { | ||
| 18381 |
1/2✓ Branch 0 taken 2719744 times.
✗ Branch 1 not taken.
|
2719744 | cauto.clear(true); |
| 18382 | } | ||
| 18383 | |||
| 18384 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | combo_auto temp_cauto; |
| 18385 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 332 times.
|
401 | for (word ca = 0; ca < num_combo_autos; ++ca) |
| 18386 | { | ||
| 18387 | byte type; | ||
| 18388 | int32_t display_cid, erase_cid; | ||
| 18389 | byte flags, arg; | ||
| 18390 |
2/4✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69 times.
✗ Branch 3 not taken.
|
69 | if (!p_getc(&type, f)) |
| 18391 | { | ||
| 18392 | ✗ | return qe_invalid; | |
| 18393 | } | ||
| 18394 |
2/4✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69 times.
✗ Branch 3 not taken.
|
69 | if (!p_igetl(&display_cid, f)) |
| 18395 | { | ||
| 18396 | ✗ | return qe_invalid; | |
| 18397 | } | ||
| 18398 |
2/4✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69 times.
✗ Branch 3 not taken.
|
69 | if (!p_igetl(&erase_cid, f)) |
| 18399 | { | ||
| 18400 | ✗ | return qe_invalid; | |
| 18401 | } | ||
| 18402 |
2/4✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69 times.
✗ Branch 3 not taken.
|
69 | if (!p_getc(&flags, f)) |
| 18403 | { | ||
| 18404 | ✗ | return qe_invalid; | |
| 18405 | } | ||
| 18406 |
2/4✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69 times.
✗ Branch 3 not taken.
|
69 | if (!p_getc(&arg, f)) |
| 18407 | { | ||
| 18408 | ✗ | return qe_invalid; | |
| 18409 | } | ||
| 18410 | 69 | int32_t num_combos_in_cauto = 0; | |
| 18411 |
2/4✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69 times.
✗ Branch 3 not taken.
|
69 | if (!p_igetl(&num_combos_in_cauto, f)) |
| 18412 | { | ||
| 18413 | ✗ | return qe_invalid; | |
| 18414 | } | ||
| 18415 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | if (num_combos_in_cauto < 1) continue; //nothing to read |
| 18416 | |||
| 18417 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | temp_cauto.clear(); |
| 18418 | |||
| 18419 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | temp_cauto.setType(type); |
| 18420 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | temp_cauto.setDisplay(display_cid); |
| 18421 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | temp_cauto.setEraseCombo(erase_cid); |
| 18422 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | temp_cauto.setFlags(flags); |
| 18423 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | temp_cauto.setArg(arg); |
| 18424 | |||
| 18425 | int32_t ca_cid; byte ca_ctype; int16_t ca_offset; int16_t ca_engrave_offset; | ||
| 18426 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 854 times.
|
923 | for (auto q = 0; q < num_combos_in_cauto; ++q) |
| 18427 | { | ||
| 18428 |
2/4✓ Branch 0 taken 854 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 854 times.
✗ Branch 3 not taken.
|
854 | if (!p_getc(&ca_ctype, f)) |
| 18429 | { | ||
| 18430 | ✗ | return qe_invalid; | |
| 18431 | } | ||
| 18432 |
2/4✓ Branch 0 taken 854 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 854 times.
✗ Branch 3 not taken.
|
854 | if (!p_igetl(&ca_cid, f)) |
| 18433 | { | ||
| 18434 | ✗ | return qe_invalid; | |
| 18435 | } | ||
| 18436 |
1/2✓ Branch 0 taken 854 times.
✗ Branch 1 not taken.
|
854 | temp_cauto.addEntry(ca_cid, ca_ctype, q, -1); |
| 18437 | 854 | } | |
| 18438 | |||
| 18439 |
1/2✓ Branch 0 taken 69 times.
✗ Branch 1 not taken.
|
69 | combo_autos[ca] = temp_cauto; |
| 18440 | 69 | } | |
| 18441 | |||
| 18442 | 332 | return 0; | |
| 18443 | 332 | } | |
| 18444 | |||
| 18445 | 690 | int32_t readcolordata(PACKFILE *f, miscQdata *Misc, word version, word build, word start_cset, word max_csets) | |
| 18446 | { | ||
| 18447 |
2/2✓ Branch 0 taken 666 times.
✓ Branch 1 taken 24 times.
|
690 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_colors); |
| 18448 | |||
| 18449 | //these are here to bypass compiler warnings about unused arguments | ||
| 18450 | //THE *48 REFERS TO EACH CSET BEING 16 COLORS with 3 VALUES OF RGB (3*16 is 48) | ||
| 18451 | //Capitalized cause it'll save you a headache. -Deedee | ||
| 18452 | 690 | start_cset=start_cset; | |
| 18453 | 690 | max_csets=max_csets; | |
| 18454 | 690 | word s_version=0; | |
| 18455 | |||
| 18456 | miscQdata temp_misc; | ||
| 18457 | 690 | memcpy(&temp_misc, Misc, sizeof(temp_misc)); | |
| 18458 | |||
| 18459 | byte temp_colordata[48]; | ||
| 18460 | char temp_palname[PALNAMESIZE+1]; | ||
| 18461 | |||
| 18462 | int32_t dummy; | ||
| 18463 | word palcycles; | ||
| 18464 | |||
| 18465 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 666 times.
|
690 | if(version > 0x192) |
| 18466 | { | ||
| 18467 | //section version info | ||
| 18468 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!p_igetw(&s_version,f)) |
| 18469 | { | ||
| 18470 | ✗ | return qe_invalid; | |
| 18471 | } | ||
| 18472 | |||
| 18473 | 666 | FFCore.quest_format[vCSets] = s_version; | |
| 18474 | |||
| 18475 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!p_igetw(&dummy,f)) |
| 18476 | { | ||
| 18477 | ✗ | return qe_invalid; | |
| 18478 | } | ||
| 18479 | |||
| 18480 | //section size | ||
| 18481 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!p_igetl(&dummy,f)) |
| 18482 | { | ||
| 18483 | ✗ | return qe_invalid; | |
| 18484 | } | ||
| 18485 | 666 | } | |
| 18486 |
2/2✓ Branch 0 taken 547 times.
✓ Branch 1 taken 143 times.
|
690 | if (s_version < 5) |
| 18487 | { | ||
| 18488 |
4/4✓ Branch 0 taken 18 times.
✓ Branch 1 taken 529 times.
✓ Branch 2 taken 523 times.
✓ Branch 3 taken 6 times.
|
547 | bool RealOldVerion = ((version < 0x192)||((version == 0x192)&&(build<73))); |
| 18489 | |||
| 18490 | //finally... section data | ||
| 18491 | 547 | int32_t q = 0; | |
| 18492 | 547 | int32_t p = -15; | |
| 18493 |
2/2✓ Branch 0 taken 131280 times.
✓ Branch 1 taken 547 times.
|
131827 | for(int32_t i=0; i<oldpdTOTAL; ++i) |
| 18494 | { | ||
| 18495 | 131280 | memset(temp_colordata, 0, 48); | |
| 18496 | |||
| 18497 |
1/2✓ Branch 0 taken 131280 times.
✗ Branch 1 not taken.
|
131280 | if(!pfread(temp_colordata,48,f)) |
| 18498 | { | ||
| 18499 | ✗ | return qe_invalid; | |
| 18500 | } | ||
| 18501 | |||
| 18502 |
2/2✓ Branch 0 taken 240 times.
✓ Branch 1 taken 131040 times.
|
131280 | if (should_skip) |
| 18503 | 240 | continue; | |
| 18504 | |||
| 18505 | 131040 | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 18506 | |||
| 18507 | 131040 | ++q; | |
| 18508 |
8/8✓ Branch 0 taken 122304 times.
✓ Branch 1 taken 8736 times.
✓ Branch 2 taken 9282 times.
✓ Branch 3 taken 113022 times.
✓ Branch 4 taken 1092 times.
✓ Branch 5 taken 8190 times.
✓ Branch 6 taken 36 times.
✓ Branch 7 taken 1056 times.
|
131040 | if (p > 0 && (p%13)==12 && (i < oldpoSPRITE || !RealOldVerion)) //It's > 0 instead of >= 0 because it should append |
| 18509 | { | ||
| 18510 |
1/2✓ Branch 0 taken 9246 times.
✗ Branch 1 not taken.
|
9246 | if (s_version < 5) //Bumping up the size of level palettes |
| 18511 | { | ||
| 18512 | 9246 | memcpy(&colordata[(q)*48], &colordata[1*48], 48); | |
| 18513 | 9246 | memcpy(&colordata[(q+1)*48], &colordata[5*48], 48); | |
| 18514 | 9246 | memcpy(&colordata[(q+2)*48], &colordata[7*48], 48); | |
| 18515 | 9246 | memcpy(&colordata[(q+3)*48], &colordata[8*48], 48); | |
| 18516 | 9246 | q+=4; | |
| 18517 | 9246 | } | |
| 18518 | else | ||
| 18519 | { | ||
| 18520 | ✗ | for(int m = 0; m < 4; ++m) | |
| 18521 | { | ||
| 18522 | ✗ | memset(temp_colordata, 0, 48); | |
| 18523 | ✗ | if(!pfread(temp_colordata,48,f)) | |
| 18524 | { | ||
| 18525 | ✗ | return qe_invalid; | |
| 18526 | } | ||
| 18527 | ✗ | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 18528 | ✗ | ++q; | |
| 18529 | ✗ | } | |
| 18530 | } | ||
| 18531 | 9246 | } | |
| 18532 | 131040 | ++p; | |
| 18533 | 131040 | } | |
| 18534 | |||
| 18535 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 529 times.
|
547 | if(RealOldVerion) |
| 18536 | { | ||
| 18537 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
|
18 | if (!should_skip) |
| 18538 | { | ||
| 18539 | 18 | memcpy(colordata+(poSPRITE255*48), colordata+((q-30)*48), 30*16*3); | |
| 18540 | 18 | memset(colordata+((q-30)*48), 0, ((poSPRITE255-(q-30))*48)); | |
| 18541 | 18 | memcpy(colordata+((poSPRITE255+11)*48), colordata+((poSPRITE255+10)*48), 48); | |
| 18542 | 18 | memcpy(colordata+((poSPRITE255+10)*48), colordata+((poSPRITE255+9)*48), 48); | |
| 18543 | 18 | memcpy(colordata+((poSPRITE255+9)*48), colordata+((poSPRITE255+8)*48), 48); | |
| 18544 | 18 | memset(colordata+((poSPRITE255+8)*48), 0, 48); | |
| 18545 | 18 | } | |
| 18546 | 18 | } | |
| 18547 | else | ||
| 18548 | { | ||
| 18549 | 529 | memset(temp_colordata, 0, 48); | |
| 18550 | |||
| 18551 |
2/2✓ Branch 0 taken 1657357 times.
✓ Branch 1 taken 529 times.
|
1657886 | for(int32_t i=0; i<newpdTOTAL-oldpdTOTAL; ++i) |
| 18552 | { | ||
| 18553 |
1/2✓ Branch 0 taken 1657357 times.
✗ Branch 1 not taken.
|
1657357 | if(!pfread(temp_colordata,48,f)) |
| 18554 | { | ||
| 18555 | ✗ | return qe_invalid; | |
| 18556 | } | ||
| 18557 | |||
| 18558 |
2/2✓ Branch 0 taken 3133 times.
✓ Branch 1 taken 1654224 times.
|
1657357 | if (should_skip) |
| 18559 | 3133 | continue; | |
| 18560 | |||
| 18561 | 1654224 | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 18562 | |||
| 18563 | 1654224 | ++q; | |
| 18564 |
7/8✓ Branch 0 taken 1654224 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 127248 times.
✓ Branch 3 taken 1526976 times.
✓ Branch 4 taken 1056 times.
✓ Branch 5 taken 126192 times.
✓ Branch 6 taken 928 times.
✓ Branch 7 taken 128 times.
|
1654224 | if (p > 0 && (p%13)==12 && (i < (newpoSPRITE-oldpdTOTAL) || (s_version >= 4))) //It's > 0 instead of >= 0 because it should append |
| 18565 | { | ||
| 18566 |
1/2✓ Branch 0 taken 127120 times.
✗ Branch 1 not taken.
|
127120 | if (s_version < 5) //Bumping up the size of level palettes |
| 18567 | { | ||
| 18568 | 127120 | memcpy(&colordata[(q)*48], &colordata[1*48], 48); | |
| 18569 | 127120 | memcpy(&colordata[(q+1)*48], &colordata[5*48], 48); | |
| 18570 | 127120 | memcpy(&colordata[(q+2)*48], &colordata[7*48], 48); | |
| 18571 | 127120 | memcpy(&colordata[(q+3)*48], &colordata[8*48], 48); | |
| 18572 | 127120 | q+=4; | |
| 18573 | 127120 | } | |
| 18574 | else | ||
| 18575 | { | ||
| 18576 | ✗ | for(int m = 0; m < 4; ++m) | |
| 18577 | { | ||
| 18578 | ✗ | memset(temp_colordata, 0, 48); | |
| 18579 | ✗ | if(!pfread(temp_colordata,48,f)) | |
| 18580 | { | ||
| 18581 | ✗ | return qe_invalid; | |
| 18582 | } | ||
| 18583 | ✗ | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 18584 | ✗ | ++q; | |
| 18585 | ✗ | } | |
| 18586 | } | ||
| 18587 | 127120 | } | |
| 18588 | 1654224 | ++p; | |
| 18589 | 1654224 | } | |
| 18590 | |||
| 18591 |
2/2✓ Branch 0 taken 65 times.
✓ Branch 1 taken 464 times.
|
529 | if(s_version < 4) |
| 18592 | { | ||
| 18593 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 64 times.
|
65 | if (!should_skip) |
| 18594 | { | ||
| 18595 | 64 | memcpy(colordata+(poSPRITE255*48), colordata+((q-30)*48), 30*16*3); | |
| 18596 | 64 | memset(colordata+((q-30)*48), 0, ((poSPRITE255-(q-30))*48)); | |
| 18597 | 64 | } | |
| 18598 | 65 | } | |
| 18599 | else | ||
| 18600 | { | ||
| 18601 |
2/2✓ Branch 0 taken 1544192 times.
✓ Branch 1 taken 464 times.
|
1544656 | for(int32_t i=0; i<newerpdTOTAL-newpdTOTAL; ++i) |
| 18602 | { | ||
| 18603 |
1/2✓ Branch 0 taken 1544192 times.
✗ Branch 1 not taken.
|
1544192 | if(!pfread(temp_colordata,48,f)) |
| 18604 | { | ||
| 18605 | ✗ | return qe_invalid; | |
| 18606 | } | ||
| 18607 | |||
| 18608 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1544192 times.
|
1544192 | if (should_skip) |
| 18609 | ✗ | continue; | |
| 18610 | |||
| 18611 | 1544192 | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 18612 | 1544192 | ++q; | |
| 18613 |
5/6✓ Branch 0 taken 1544192 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 118784 times.
✓ Branch 3 taken 1425408 times.
✓ Branch 4 taken 928 times.
✓ Branch 5 taken 117856 times.
|
1544192 | if (p > 0 && (p%13)==12 && i < newerpoSPRITE-newpdTOTAL) //It's > 0 instead of >= 0 because it should append |
| 18614 | { | ||
| 18615 |
1/2✓ Branch 0 taken 117856 times.
✗ Branch 1 not taken.
|
117856 | if (s_version < 5) //Bumping up the size of level palettes |
| 18616 | { | ||
| 18617 | 117856 | memcpy(&colordata[(q)*48], &colordata[1*48], 48); | |
| 18618 | 117856 | memcpy(&colordata[(q+1)*48], &colordata[5*48], 48); | |
| 18619 | 117856 | memcpy(&colordata[(q+2)*48], &colordata[7*48], 48); | |
| 18620 | 117856 | memcpy(&colordata[(q+3)*48], &colordata[8*48], 48); | |
| 18621 | 117856 | q+=4; | |
| 18622 | 117856 | } | |
| 18623 | else | ||
| 18624 | { | ||
| 18625 | ✗ | for(int m = 0; m < 4; ++m) | |
| 18626 | { | ||
| 18627 | ✗ | memset(temp_colordata, 0, 48); | |
| 18628 | ✗ | if(!pfread(temp_colordata,48,f)) | |
| 18629 | { | ||
| 18630 | ✗ | return qe_invalid; | |
| 18631 | } | ||
| 18632 | ✗ | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 18633 | ✗ | ++q; | |
| 18634 | ✗ | } | |
| 18635 | } | ||
| 18636 | 117856 | } | |
| 18637 | 1544192 | ++p; | |
| 18638 | 1544192 | } | |
| 18639 | |||
| 18640 | //By this point, q should be about equal to pdTOTAL255. If it isn't, I've fucked up. -Deedee | ||
| 18641 | } | ||
| 18642 | } | ||
| 18643 | 547 | } | |
| 18644 | else | ||
| 18645 | { | ||
| 18646 |
2/2✓ Branch 0 taken 1251107 times.
✓ Branch 1 taken 143 times.
|
1251250 | for(int32_t i=0; i<pdTOTAL255; ++i) |
| 18647 | { | ||
| 18648 | 1251107 | memset(temp_colordata, 0, 48); | |
| 18649 | |||
| 18650 |
1/2✓ Branch 0 taken 1251107 times.
✗ Branch 1 not taken.
|
1251107 | if(!pfread(temp_colordata,48,f)) |
| 18651 | { | ||
| 18652 | ✗ | return qe_invalid; | |
| 18653 | } | ||
| 18654 | |||
| 18655 | 1251107 | memcpy(&colordata[i*48], temp_colordata, 48); | |
| 18656 | 1251107 | } | |
| 18657 | } | ||
| 18658 | |||
| 18659 |
4/4✓ Branch 0 taken 689 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 102 times.
✓ Branch 3 taken 587 times.
|
690 | if (!should_skip && s_version < 6) |
| 18660 | { | ||
| 18661 |
2/2✓ Branch 0 taken 246511824 times.
✓ Branch 1 taken 587 times.
|
246512411 | for (int i = 0; i < psTOTAL255; i++) |
| 18662 | { | ||
| 18663 | 246511824 | colordata[i] = _rgb_scale_6[colordata[i]]; | |
| 18664 | 246511824 | } | |
| 18665 | 587 | } | |
| 18666 | |||
| 18667 |
5/6✓ Branch 0 taken 672 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 666 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
|
690 | if((version < 0x192)||((version == 0x192)&&(build<76))) |
| 18668 | { | ||
| 18669 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
|
18 | if (!should_skip) |
| 18670 | 18 | init_palnames(); | |
| 18671 | 18 | } | |
| 18672 | else | ||
| 18673 | { | ||
| 18674 | 672 | int32_t palnamestoread = 0; | |
| 18675 | |||
| 18676 |
2/2✓ Branch 0 taken 65 times.
✓ Branch 1 taken 607 times.
|
672 | if(s_version < 3) |
| 18677 | 65 | palnamestoread = OLDMAXLEVELS; | |
| 18678 | else | ||
| 18679 | 607 | palnamestoread = 512; | |
| 18680 | |||
| 18681 |
2/2✓ Branch 0 taken 327424 times.
✓ Branch 1 taken 672 times.
|
328096 | for(int32_t i=0; i<palnamestoread; ++i) |
| 18682 | { | ||
| 18683 |
1/2✓ Branch 0 taken 327424 times.
✗ Branch 1 not taken.
|
327424 | if(!p_getstr(temp_palname,PALNAMESIZE,f)) |
| 18684 | { | ||
| 18685 | ✗ | return qe_invalid; | |
| 18686 | } | ||
| 18687 | |||
| 18688 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 327168 times.
|
327424 | if (!should_skip) |
| 18689 | 327168 | memcpy(palnames[i], temp_palname, PALNAMESIZE); | |
| 18690 | 327424 | } | |
| 18691 | |||
| 18692 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 671 times.
|
672 | if (should_skip) |
| 18693 | 1 | return 0; | |
| 18694 | |||
| 18695 |
2/2✓ Branch 0 taken 16384 times.
✓ Branch 1 taken 671 times.
|
17055 | for(int32_t i=palnamestoread; i<MAXLEVELS; i++) |
| 18696 | { | ||
| 18697 | 16384 | memset(palnames[i], 0, PALNAMESIZE); | |
| 18698 | 16384 | } | |
| 18699 | } | ||
| 18700 | |||
| 18701 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 666 times.
|
689 | if(version > 0x192) |
| 18702 | { | ||
| 18703 |
2/2✓ Branch 0 taken 170496 times.
✓ Branch 1 taken 666 times.
|
171162 | for(int32_t i=0; i<256; i++) |
| 18704 | { | ||
| 18705 |
2/2✓ Branch 0 taken 511488 times.
✓ Branch 1 taken 170496 times.
|
681984 | for(int32_t j=0; j<3; j++) |
| 18706 | { | ||
| 18707 | 511488 | temp_misc.cycles[i][j].first=0; | |
| 18708 | 511488 | temp_misc.cycles[i][j].count=0; | |
| 18709 | 511488 | temp_misc.cycles[i][j].speed=0; | |
| 18710 | 511488 | } | |
| 18711 | 170496 | } | |
| 18712 | |||
| 18713 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!p_igetw(&palcycles,f)) |
| 18714 | { | ||
| 18715 | ✗ | return qe_invalid; | |
| 18716 | } | ||
| 18717 | |||
| 18718 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 666 times.
|
666 | if (palcycles > NUM_PAL_CYCLES) |
| 18719 | { | ||
| 18720 | ✗ | return qe_invalid; | |
| 18721 | } | ||
| 18722 | |||
| 18723 |
2/2✓ Branch 0 taken 19742 times.
✓ Branch 1 taken 666 times.
|
20408 | for(int32_t i=0; i<palcycles; i++) |
| 18724 | { | ||
| 18725 |
2/2✓ Branch 0 taken 59226 times.
✓ Branch 1 taken 19742 times.
|
78968 | for(int32_t j=0; j<3; j++) |
| 18726 | { | ||
| 18727 |
1/2✓ Branch 0 taken 59226 times.
✗ Branch 1 not taken.
|
59226 | if(!p_getc(&temp_misc.cycles[i][j].first,f)) |
| 18728 | { | ||
| 18729 | ✗ | return qe_invalid; | |
| 18730 | } | ||
| 18731 | 59226 | } | |
| 18732 | |||
| 18733 |
2/2✓ Branch 0 taken 59226 times.
✓ Branch 1 taken 19742 times.
|
78968 | for(int32_t j=0; j<3; j++) |
| 18734 | { | ||
| 18735 |
1/2✓ Branch 0 taken 59226 times.
✗ Branch 1 not taken.
|
59226 | if(!p_getc(&temp_misc.cycles[i][j].count,f)) |
| 18736 | { | ||
| 18737 | ✗ | return qe_invalid; | |
| 18738 | } | ||
| 18739 | 59226 | } | |
| 18740 | |||
| 18741 |
2/2✓ Branch 0 taken 59226 times.
✓ Branch 1 taken 19742 times.
|
78968 | for(int32_t j=0; j<3; j++) |
| 18742 | { | ||
| 18743 |
1/2✓ Branch 0 taken 59226 times.
✗ Branch 1 not taken.
|
59226 | if(!p_getc(&temp_misc.cycles[i][j].speed,f)) |
| 18744 | { | ||
| 18745 | ✗ | return qe_invalid; | |
| 18746 | } | ||
| 18747 | 59226 | } | |
| 18748 | 19742 | } | |
| 18749 | |||
| 18750 | 666 | memcpy(Misc, &temp_misc, sizeof(temp_misc)); | |
| 18751 | 666 | } | |
| 18752 | |||
| 18753 | 689 | return 0; | |
| 18754 | 690 | } | |
| 18755 | |||
| 18756 | 690 | int32_t readtiles(PACKFILE *f, tiledata *buf, zquestheader *Header, word version, word build, word start_tile, int32_t max_tiles, bool from_init) | |
| 18757 | { | ||
| 18758 |
2/2✓ Branch 0 taken 666 times.
✓ Branch 1 taken 24 times.
|
690 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_tiles); |
| 18759 | |||
| 18760 | 690 | int32_t tiles_used=0; | |
| 18761 | 690 | word section_version = 0; | |
| 18762 | 690 | word section_cversion = 0; | |
| 18763 | 690 | int32_t section_size= 0; | |
| 18764 | 690 | byte *temp_tile = new byte[tilesize(tf32Bit)]; | |
| 18765 | |||
| 18766 | //Tile Expansion | ||
| 18767 | //if ( version >= 0x254 && build >= 41 ) | ||
| 18768 |
4/4✓ Branch 0 taken 547 times.
✓ Branch 1 taken 143 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 541 times.
|
690 | if (version < 0x254 && build < 41) |
| 18769 | { | ||
| 18770 | 541 | max_tiles = ZC250MAXTILES; | |
| 18771 | 541 | } | |
| 18772 | |||
| 18773 | |||
| 18774 |
2/6✓ Branch 0 taken 690 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 690 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
690 | if(Header!=NULL&&(!Header->data_flags[ZQ_TILES]&&!from_init)) //keep for old quests |
| 18775 | { | ||
| 18776 | ✗ | if(!init_tiles_for_190(true, Header)) | |
| 18777 | { | ||
| 18778 | ✗ | al_trace("Unable to initialize tiles\n"); | |
| 18779 | ✗ | } | |
| 18780 | |||
| 18781 | ✗ | delete[] temp_tile; | |
| 18782 | ✗ | temp_tile=NULL; | |
| 18783 | ✗ | return 0; | |
| 18784 | } | ||
| 18785 | else | ||
| 18786 | { | ||
| 18787 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 666 times.
|
690 | if(version > 0x192) |
| 18788 | { | ||
| 18789 | //section version info | ||
| 18790 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!p_igetw(§ion_version,f)) |
| 18791 | { | ||
| 18792 | ✗ | delete[] temp_tile; | |
| 18793 | ✗ | return qe_invalid; | |
| 18794 | } | ||
| 18795 | |||
| 18796 | 666 | FFCore.quest_format[vTiles] = section_version; | |
| 18797 | |||
| 18798 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!p_igetw(§ion_cversion,f)) |
| 18799 | { | ||
| 18800 | ✗ | delete[] temp_tile; | |
| 18801 | ✗ | return qe_invalid; | |
| 18802 | } | ||
| 18803 | |||
| 18804 | //section size | ||
| 18805 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!p_igetl(§ion_size,f)) |
| 18806 | { | ||
| 18807 | ✗ | delete[] temp_tile; | |
| 18808 | ✗ | return qe_invalid; | |
| 18809 | } | ||
| 18810 | 666 | } | |
| 18811 | |||
| 18812 | //if ( build < 41 ) | ||
| 18813 | //{ | ||
| 18814 | // tiles_used = ZC250MAXTILES; | ||
| 18815 | //} | ||
| 18816 | |||
| 18817 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 690 times.
|
690 | if(version < 0x174) |
| 18818 | { | ||
| 18819 | ✗ | tiles_used=TILES_PER_PAGE*4; | |
| 18820 | ✗ | } //no expanded tile space | |
| 18821 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 672 times.
|
690 | else if(version < 0x191) |
| 18822 | { | ||
| 18823 | 18 | tiles_used=OLDMAXTILES; | |
| 18824 | 18 | } | |
| 18825 | else | ||
| 18826 | { | ||
| 18827 | //finally... section data | ||
| 18828 |
3/4✓ Branch 0 taken 143 times.
✓ Branch 1 taken 529 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 143 times.
|
672 | if ( version >= 0x254 && build >= 41 ) //read and write the size of tiles_used properly |
| 18829 | { | ||
| 18830 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | if(!p_igetl(&tiles_used,f)) |
| 18831 | { | ||
| 18832 | ✗ | delete[] temp_tile; | |
| 18833 | ✗ | return qe_invalid; | |
| 18834 | } | ||
| 18835 | 143 | } | |
| 18836 | else | ||
| 18837 | { | ||
| 18838 |
1/2✓ Branch 0 taken 529 times.
✗ Branch 1 not taken.
|
529 | if(!p_igetw(&tiles_used,f)) |
| 18839 | { | ||
| 18840 | ✗ | delete[] temp_tile; | |
| 18841 | ✗ | return qe_invalid; | |
| 18842 | } | ||
| 18843 | } | ||
| 18844 | } | ||
| 18845 | |||
| 18846 |
1/2✓ Branch 0 taken 690 times.
✗ Branch 1 not taken.
|
690 | tiles_used=zc_min(tiles_used, max_tiles); |
| 18847 | |||
| 18848 | //if ( version < 0x254 || ( version >= 0x254 && build < 41 )) //don't do this, it crashes ZQuest. -Z | ||
| 18849 | //if ( version < 0x254 && build < 41 ) | ||
| 18850 |
3/6✓ Branch 0 taken 143 times.
✓ Branch 1 taken 547 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 143 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
690 | if ( version < 0x254 || (version == 0x254 && build < 41) ) |
| 18851 | //if ( build < 41 ) | ||
| 18852 | { | ||
| 18853 |
1/2✓ Branch 0 taken 547 times.
✗ Branch 1 not taken.
|
547 | tiles_used=zc_min(tiles_used, ZC250MAXTILES-start_tile); |
| 18854 | 547 | } | |
| 18855 | else //2.55 | ||
| 18856 | { | ||
| 18857 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | tiles_used = zc_min(tiles_used,NEWMAXTILES-start_tile); |
| 18858 | } | ||
| 18859 | |||
| 18860 | //if ( section_version > 1 ) tiles_used = NEWMAXTILES; | ||
| 18861 | |||
| 18862 | |||
| 18863 |
2/2✓ Branch 0 taken 16524167 times.
✓ Branch 1 taken 690 times.
|
16524857 | for(int32_t i=0; i<tiles_used; ++i) |
| 18864 | { | ||
| 18865 | 16524167 | byte format=tf4Bit; | |
| 18866 | 16524167 | memset(temp_tile, 0, tilesize(tf32Bit)); | |
| 18867 | |||
| 18868 |
3/6✓ Branch 0 taken 2985456 times.
✓ Branch 1 taken 13538711 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2985456 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
16524167 | if((version>0x211)||((version==0x211)&&(build>4))) |
| 18869 | { | ||
| 18870 |
1/2✓ Branch 0 taken 13538711 times.
✗ Branch 1 not taken.
|
13538711 | if(!p_getc(&format,f)) |
| 18871 | { | ||
| 18872 | ✗ | delete[] temp_tile; | |
| 18873 | ✗ | return qe_invalid; | |
| 18874 | } | ||
| 18875 | 13538711 | } | |
| 18876 |
4/4✓ Branch 0 taken 5827676 times.
✓ Branch 1 taken 10696491 times.
✓ Branch 2 taken 2538605 times.
✓ Branch 3 taken 3289071 times.
|
16524167 | if(section_version > 2 && !format) |
| 18877 | { | ||
| 18878 | 3289071 | reset_tile(buf,start_tile+i,tf4Bit); | |
| 18879 | 3289071 | continue; | |
| 18880 | } | ||
| 18881 | |||
| 18882 |
2/2✓ Branch 0 taken 12769121 times.
✓ Branch 1 taken 465975 times.
|
13235096 | int size = format == tf4Bit ? 128 : tilesize(format); |
| 18883 |
1/2✓ Branch 0 taken 13235096 times.
✗ Branch 1 not taken.
|
13235096 | if(!pfread(temp_tile,size,f)) |
| 18884 | { | ||
| 18885 | ✗ | delete[] temp_tile; | |
| 18886 | ✗ | return qe_invalid; | |
| 18887 | } | ||
| 18888 | |||
| 18889 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13235096 times.
|
13235096 | if (should_skip) |
| 18890 | ✗ | continue; | |
| 18891 | |||
| 18892 | 13235096 | buf[start_tile+i].format=format; | |
| 18893 | |||
| 18894 |
2/2✓ Branch 0 taken 13063952 times.
✓ Branch 1 taken 171144 times.
|
13235096 | if(buf[start_tile+i].data) |
| 18895 | { | ||
| 18896 | 13063952 | free(buf[start_tile+i].data); | |
| 18897 | 13063952 | buf[start_tile+i].data=NULL; | |
| 18898 | 13063952 | } | |
| 18899 | |||
| 18900 | 13235096 | buf[start_tile+i].data=(byte *)malloc(tilesize(buf[start_tile+i].format)); | |
| 18901 | |||
| 18902 |
2/2✓ Branch 0 taken 12769121 times.
✓ Branch 1 taken 465975 times.
|
13235096 | if (format == tf4Bit) |
| 18903 | { | ||
| 18904 | byte temp[256]; | ||
| 18905 | 12769121 | byte *si = temp_tile + 128; | |
| 18906 | 12769121 | byte *di = temp + 256; | |
| 18907 | |||
| 18908 |
2/2✓ Branch 0 taken 1634447488 times.
✓ Branch 1 taken 12769121 times.
|
1647216609 | for(int i=127; i>=0; --i) |
| 18909 | { | ||
| 18910 | 1634447488 | (*(--di)) = (*(--si)) >> 4; | |
| 18911 | 1634447488 | (*(--di)) = (*si) & 15; | |
| 18912 | 1634447488 | } | |
| 18913 | |||
| 18914 | 12769121 | memcpy(buf[start_tile+i].data,temp,256); | |
| 18915 | 12769121 | } | |
| 18916 | else | ||
| 18917 | { | ||
| 18918 | 465975 | memcpy(buf[start_tile+i].data,temp_tile,tilesize(buf[start_tile+i].format)); | |
| 18919 | } | ||
| 18920 | 13235096 | } | |
| 18921 | } | ||
| 18922 | |||
| 18923 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 690 times.
|
690 | if (should_skip) |
| 18924 | ✗ | return 0; | |
| 18925 | |||
| 18926 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 547 times.
|
690 | if ( section_version < 2 ) //write blank tile data --check s_version with this again instead? |
| 18927 | { | ||
| 18928 |
2/2✓ Branch 0 taken 81492060 times.
✓ Branch 1 taken 547 times.
|
81492607 | for ( int32_t q = ZC250MAXTILES; q < NEWMAXTILES; ++q ) |
| 18929 | { | ||
| 18930 | |||
| 18931 | //memcpy(buf[q].data,temp_tile,tilesize(buf[q].format)); | ||
| 18932 | 81492060 | reset_tile(buf,q,tf4Bit); | |
| 18933 | |||
| 18934 | |||
| 18935 | /* | ||
| 18936 | |||
| 18937 | byte tempbyte; | ||
| 18938 | for(int32_t i=0; i<tilesize(tf4Bit); i++) | ||
| 18939 | { | ||
| 18940 | tempbyte=buf[ZC250MAXTILES-1].data[i]; | ||
| 18941 | buf[q].data[i] = tempbyte; | ||
| 18942 | } | ||
| 18943 | //int32_t temp = tempbyte=buf[130].data[i]; | ||
| 18944 | //buf[q].data = buf[ZC250MAXTILES-1].data; | ||
| 18945 | */ | ||
| 18946 | //reset_tile(buf,q,tf4Bit); | ||
| 18947 | 81492060 | } | |
| 18948 | |||
| 18949 | 547 | } | |
| 18950 | |||
| 18951 |
4/6✓ Branch 0 taken 143 times.
✓ Branch 1 taken 547 times.
✓ Branch 2 taken 143 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 143 times.
|
690 | if ( version < 0x254 || ( version >= 0x254 && build < 41 )) |
| 18952 | { | ||
| 18953 |
2/2✓ Branch 0 taken 26610545 times.
✓ Branch 1 taken 547 times.
|
26611092 | for(int32_t i=start_tile+tiles_used; i<max_tiles; ++i) |
| 18954 | { | ||
| 18955 | 26610545 | reset_tile(buf,i,tf4Bit); | |
| 18956 | 26610545 | } | |
| 18957 | 547 | } | |
| 18958 | else | ||
| 18959 | { | ||
| 18960 |
2/2✓ Branch 0 taken 24272108 times.
✓ Branch 1 taken 143 times.
|
24272251 | for(int32_t i=start_tile+tiles_used; i<max_tiles; ++i) |
| 18961 | { | ||
| 18962 | 24272108 | reset_tile(buf,i,tf4Bit); | |
| 18963 | 24272108 | } | |
| 18964 | } | ||
| 18965 | |||
| 18966 |
5/6✓ Branch 0 taken 672 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 666 times.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
690 | if((version < 0x192)|| ((version == 0x192)&&(build<186))) |
| 18967 | { | ||
| 18968 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 6 times.
|
24 | if(get_qr(qr_BSZELDA)) // |
| 18969 | { | ||
| 18970 | byte tempbyte; | ||
| 18971 | 6 | int32_t floattile=wpnsbuf[iwSwim].tile; | |
| 18972 | |||
| 18973 |
2/2✓ Branch 0 taken 1536 times.
✓ Branch 1 taken 6 times.
|
1542 | for(int32_t i=0; i<tilesize(tf4Bit); i++) //BSZelda tiles are out of order //does this include swim tiles? |
| 18974 | { | ||
| 18975 | 1536 | tempbyte=buf[23].data[i]; | |
| 18976 | 1536 | buf[23].data[i]=buf[24].data[i]; | |
| 18977 | 1536 | buf[24].data[i]=buf[25].data[i]; | |
| 18978 | 1536 | buf[25].data[i]=buf[26].data[i]; | |
| 18979 | 1536 | buf[26].data[i]=tempbyte; | |
| 18980 | 1536 | } | |
| 18981 | //swim tiles are out of order, too, but nobody cared? -Z | ||
| 18982 |
2/2✓ Branch 0 taken 1536 times.
✓ Branch 1 taken 6 times.
|
1542 | for(int32_t i=0; i<tilesize(tf4Bit); i++) |
| 18983 | { | ||
| 18984 | 1536 | tempbyte=buf[floattile+11].data[i]; | |
| 18985 | 1536 | buf[floattile+11].data[i]=buf[floattile+12].data[i]; | |
| 18986 | 1536 | buf[floattile+12].data[i]=tempbyte; | |
| 18987 | 1536 | } | |
| 18988 | 6 | } | |
| 18989 | 24 | } | |
| 18990 | |||
| 18991 |
3/6✓ Branch 0 taken 607 times.
✓ Branch 1 taken 83 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 607 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
690 | if((version < 0x211)||((version == 0x211)&&(build<7))) //Goriya tiles are out of order |
| 18992 | { | ||
| 18993 |
2/2✓ Branch 0 taken 61 times.
✓ Branch 1 taken 22 times.
|
83 | if(!get_qr(qr_NEWENEMYTILES)) |
| 18994 | { | ||
| 18995 | byte tempbyte; | ||
| 18996 | |||
| 18997 |
2/2✓ Branch 0 taken 5632 times.
✓ Branch 1 taken 22 times.
|
5654 | for(int32_t i=0; i<tilesize(tf4Bit); i++) |
| 18998 | { | ||
| 18999 | 5632 | tempbyte=buf[130].data[i]; | |
| 19000 | 5632 | buf[130].data[i]=buf[132].data[i]; | |
| 19001 | 5632 | buf[132].data[i]=tempbyte; | |
| 19002 | |||
| 19003 | 5632 | tempbyte=buf[131].data[i]; | |
| 19004 | 5632 | buf[131].data[i]=buf[133].data[i]; | |
| 19005 | 5632 | buf[133].data[i]=tempbyte; | |
| 19006 | 5632 | } | |
| 19007 | 22 | } | |
| 19008 | 83 | } | |
| 19009 | |||
| 19010 | 690 | al_trace("Registering blank tiles\n"); | |
| 19011 | 690 | register_blank_tiles(); | |
| 19012 | |||
| 19013 | //memset(temp_tile, 0, tilesize(tf32Bit)); | ||
| 19014 |
1/2✓ Branch 0 taken 690 times.
✗ Branch 1 not taken.
|
690 | delete[] temp_tile; |
| 19015 | 690 | temp_tile=NULL; | |
| 19016 | 690 | return 0; | |
| 19017 | 690 | } | |
| 19018 | |||
| 19019 | 414 | int32_t readtunes(PACKFILE *f, zquestheader *Header, zctune *tunes /*zcmidi_ *midis*/) | |
| 19020 | { | ||
| 19021 |
2/2✓ Branch 0 taken 391 times.
✓ Branch 1 taken 23 times.
|
414 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_midis); |
| 19022 | |||
| 19023 | static byte fake_midi_flags[32]; | ||
| 19024 | |||
| 19025 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 414 times.
|
414 | byte *mf=should_skip ? fake_midi_flags : midi_flags; |
| 19026 | int32_t dummy; | ||
| 19027 | word dummy2; | ||
| 19028 | // zcmidi_ temp_midi; | ||
| 19029 | int32_t tunes_to_read; | ||
| 19030 | 414 | int32_t tune_count=0; | |
| 19031 | 414 | word section_version=0; | |
| 19032 | 414 | zctune temp; | |
| 19033 | |||
| 19034 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 391 times.
|
414 | if(Header->zelda_version < 0x193) |
| 19035 | { | ||
| 19036 | // mf=Header->data_flags+ZQ_MIDIS2; | ||
| 19037 |
5/6✓ Branch 0 taken 5 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 1 times.
|
23 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<178))) |
| 19038 | { | ||
| 19039 | 22 | tunes_to_read=MAXCUSTOMMIDIS192b177; | |
| 19040 | 22 | } | |
| 19041 | else | ||
| 19042 | { | ||
| 19043 | 1 | tunes_to_read=MAXCUSTOMTUNES; | |
| 19044 | } | ||
| 19045 | 23 | } | |
| 19046 | else | ||
| 19047 | { | ||
| 19048 | //section version info | ||
| 19049 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | if(!p_igetw(§ion_version,f)) |
| 19050 | { | ||
| 19051 | ✗ | return qe_invalid; | |
| 19052 | } | ||
| 19053 | |||
| 19054 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
|
391 | if (!should_skip) |
| 19055 | 391 | FFCore.quest_format[vMIDIs] = section_version; | |
| 19056 | |||
| 19057 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | if(!p_igetw(&dummy2,f)) |
| 19058 | { | ||
| 19059 | ✗ | return qe_invalid; | |
| 19060 | } | ||
| 19061 | |||
| 19062 | //section size | ||
| 19063 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | if(!p_igetl(&dummy,f)) |
| 19064 | { | ||
| 19065 | ✗ | return qe_invalid; | |
| 19066 | } | ||
| 19067 | |||
| 19068 | //finally... section data | ||
| 19069 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | if(!pfread(midi_flags,sizeof(midi_flags),f)) |
| 19070 | { | ||
| 19071 | ✗ | return qe_invalid; | |
| 19072 | } | ||
| 19073 | |||
| 19074 | 391 | tunes_to_read=MAXCUSTOMTUNES; | |
| 19075 | } | ||
| 19076 | |||
| 19077 |
2/2✓ Branch 0 taken 104328 times.
✓ Branch 1 taken 414 times.
|
104742 | for(int32_t i=0; i<MAXCUSTOMTUNES; ++i) |
| 19078 | { | ||
| 19079 |
2/2✓ Branch 0 taken 9963 times.
✓ Branch 1 taken 94365 times.
|
104328 | if(get_bit(mf, i)) |
| 19080 | { | ||
| 19081 | 9963 | ++tune_count; | |
| 19082 | 9963 | } | |
| 19083 | 104328 | } | |
| 19084 | |||
| 19085 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 414 times.
|
414 | if (!should_skip) |
| 19086 | 414 | reset_tunes(tunes); //reset_midis(midis); | |
| 19087 | |||
| 19088 |
2/2✓ Branch 0 taken 99488 times.
✓ Branch 1 taken 414 times.
|
99902 | for(int32_t i=0; i<tunes_to_read; i++) |
| 19089 | { | ||
| 19090 | 99488 | temp.clear(); //memset(&temp_midi,0,sizeof(zcmidi_)); | |
| 19091 | |||
| 19092 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 99488 times.
|
99488 | if (!should_skip) |
| 19093 | 99488 | tunes[i].reset(); // reset_midi(midis+i); | |
| 19094 | |||
| 19095 |
2/2✓ Branch 0 taken 89525 times.
✓ Branch 1 taken 9963 times.
|
99488 | if(get_bit(mf,i)) |
| 19096 | { | ||
| 19097 |
2/2✓ Branch 0 taken 2663 times.
✓ Branch 1 taken 7300 times.
|
9963 | if(section_version < 4) |
| 19098 | { | ||
| 19099 |
1/2✓ Branch 0 taken 2663 times.
✗ Branch 1 not taken.
|
2663 | if(!p_getstr(temp.title,20,f)) |
| 19100 | { | ||
| 19101 | ✗ | return qe_invalid; | |
| 19102 | } | ||
| 19103 | 2663 | } | |
| 19104 | else | ||
| 19105 | { | ||
| 19106 |
1/2✓ Branch 0 taken 7300 times.
✗ Branch 1 not taken.
|
7300 | if(!p_getstr(temp.title,sizeof(temp.title)-1,f)) |
| 19107 | { | ||
| 19108 | ✗ | return qe_invalid; | |
| 19109 | } | ||
| 19110 | } | ||
| 19111 | |||
| 19112 |
1/2✓ Branch 0 taken 9963 times.
✗ Branch 1 not taken.
|
9963 | if(!p_igetl(&temp.start,f)) |
| 19113 | { | ||
| 19114 | ✗ | return qe_invalid; | |
| 19115 | } | ||
| 19116 | |||
| 19117 |
1/2✓ Branch 0 taken 9963 times.
✗ Branch 1 not taken.
|
9963 | if(!p_igetl(&temp.loop_start,f)) |
| 19118 | { | ||
| 19119 | ✗ | return qe_invalid; | |
| 19120 | } | ||
| 19121 | |||
| 19122 |
1/2✓ Branch 0 taken 9963 times.
✗ Branch 1 not taken.
|
9963 | if(!p_igetl(&temp.loop_end,f)) |
| 19123 | { | ||
| 19124 | ✗ | return qe_invalid; | |
| 19125 | } | ||
| 19126 | |||
| 19127 |
1/2✓ Branch 0 taken 9963 times.
✗ Branch 1 not taken.
|
9963 | if(!p_igetw(&temp.loop,f)) |
| 19128 | { | ||
| 19129 | ✗ | return qe_invalid; | |
| 19130 | } | ||
| 19131 | |||
| 19132 |
1/2✓ Branch 0 taken 9963 times.
✗ Branch 1 not taken.
|
9963 | if(!p_igetw(&temp.volume,f)) |
| 19133 | { | ||
| 19134 | ✗ | return qe_invalid; | |
| 19135 | } | ||
| 19136 | |||
| 19137 |
2/2✓ Branch 0 taken 9714 times.
✓ Branch 1 taken 249 times.
|
9963 | if(Header->zelda_version < 0x193) |
| 19138 | { | ||
| 19139 |
1/2✓ Branch 0 taken 249 times.
✗ Branch 1 not taken.
|
249 | if(!p_igetl(&dummy,f)) |
| 19140 | { | ||
| 19141 | ✗ | return qe_invalid; | |
| 19142 | } | ||
| 19143 | 249 | } | |
| 19144 | |||
| 19145 |
2/2✓ Branch 0 taken 2663 times.
✓ Branch 1 taken 7300 times.
|
9963 | if(section_version >= 3) |
| 19146 | { | ||
| 19147 |
1/2✓ Branch 0 taken 7300 times.
✗ Branch 1 not taken.
|
7300 | if(!pfread(&temp.flags,sizeof(temp.flags),f)) |
| 19148 | { | ||
| 19149 | ✗ | return qe_invalid; | |
| 19150 | } | ||
| 19151 | 7300 | } | |
| 19152 | |||
| 19153 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9963 times.
|
9963 | if (!should_skip) |
| 19154 | 9963 | tunes[i].copyfrom(temp); // memcpy(&midis[i], &temp_midi, sizeof(zcmidi_)); | |
| 19155 | |||
| 19156 |
2/2✓ Branch 0 taken 2663 times.
✓ Branch 1 taken 7300 times.
|
9963 | if(section_version < 2) //= 1 || (Header->zelda_version < 0x211) || (Header->zelda_version == 0x211 && Header->build < 18)) |
| 19157 | { | ||
| 19158 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2663 times.
|
2663 | if (should_skip) |
| 19159 | { | ||
| 19160 | ✗ | if (read_midi(f)==NULL) | |
| 19161 | { | ||
| 19162 | ✗ | return qe_invalid; | |
| 19163 | } | ||
| 19164 | |||
| 19165 | ✗ | continue; | |
| 19166 | } | ||
| 19167 | |||
| 19168 | // old format - a midi is a midi | ||
| 19169 |
1/2✓ Branch 0 taken 2663 times.
✗ Branch 1 not taken.
|
2663 | if((tunes[i].data=read_midi(f))==NULL) |
| 19170 | { | ||
| 19171 | ✗ | return qe_invalid; | |
| 19172 | } | ||
| 19173 | 2663 | } | |
| 19174 | else | ||
| 19175 | { | ||
| 19176 | byte format; | ||
| 19177 |
1/2✓ Branch 0 taken 7300 times.
✗ Branch 1 not taken.
|
7300 | if(!pfread(&format,sizeof(format),f)) |
| 19178 | { | ||
| 19179 | ✗ | return qe_invalid; | |
| 19180 | } | ||
| 19181 | |||
| 19182 | // MIDI is the only format saved here. | ||
| 19183 | // Never did more than MIDI for a zctune, and no plans to now. | ||
| 19184 |
1/2✓ Branch 0 taken 7300 times.
✗ Branch 1 not taken.
|
7300 | if (format != MFORMAT_MIDI) |
| 19185 | { | ||
| 19186 | ✗ | return qe_invalid; | |
| 19187 | } | ||
| 19188 | |||
| 19189 | 7300 | tunes[i].data = read_midi(f); | |
| 19190 |
1/2✓ Branch 0 taken 7300 times.
✗ Branch 1 not taken.
|
7300 | if (!tunes[i].data) |
| 19191 | { | ||
| 19192 | ✗ | return qe_invalid; | |
| 19193 | } | ||
| 19194 | } | ||
| 19195 | 9963 | } | |
| 19196 | 99488 | } | |
| 19197 | |||
| 19198 | 414 | return 0; | |
| 19199 | 414 | } | |
| 19200 | |||
| 19201 | 414 | int32_t readcheatcodes(PACKFILE *f, zquestheader *Header) | |
| 19202 | { | ||
| 19203 |
2/2✓ Branch 0 taken 391 times.
✓ Branch 1 taken 23 times.
|
414 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_cheats); |
| 19204 | |||
| 19205 | int32_t dummy; | ||
| 19206 | ZCHEATS tempzcheats; | ||
| 19207 | 414 | char temp_use_cheats=1; | |
| 19208 | 414 | memset(&tempzcheats, 0, sizeof(tempzcheats)); | |
| 19209 | 414 | word s_version = 0; | |
| 19210 | |||
| 19211 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 391 times.
|
414 | if(Header->zelda_version > 0x192) |
| 19212 | { | ||
| 19213 | //section version info | ||
| 19214 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | if(!p_igetw(&s_version,f)) |
| 19215 | { | ||
| 19216 | ✗ | return qe_invalid; | |
| 19217 | } | ||
| 19218 | |||
| 19219 | 391 | FFCore.quest_format[vCheats] = s_version; | |
| 19220 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | if(!p_igetw(&dummy,f)) |
| 19221 | { | ||
| 19222 | ✗ | return qe_invalid; | |
| 19223 | } | ||
| 19224 | |||
| 19225 | //section size | ||
| 19226 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | if(!p_igetl(&dummy,f)) |
| 19227 | { | ||
| 19228 | ✗ | return qe_invalid; | |
| 19229 | } | ||
| 19230 | |||
| 19231 | //finally... section data | ||
| 19232 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
|
391 | if(!p_getc(&temp_use_cheats,f)) |
| 19233 | { | ||
| 19234 | ✗ | return qe_invalid; | |
| 19235 | } | ||
| 19236 | 391 | } | |
| 19237 | |||
| 19238 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 414 times.
|
414 | if(Header->data_flags[ZQ_CHEATS2]) |
| 19239 | { | ||
| 19240 |
1/2✓ Branch 0 taken 414 times.
✗ Branch 1 not taken.
|
414 | if(!p_igetl(&tempzcheats.flags,f)) |
| 19241 | { | ||
| 19242 | ✗ | return qe_invalid; | |
| 19243 | } | ||
| 19244 | |||
| 19245 |
1/2✓ Branch 0 taken 414 times.
✗ Branch 1 not taken.
|
414 | if(!pfread(&tempzcheats.codes, sizeof(tempzcheats.codes),f)) |
| 19246 | { | ||
| 19247 | ✗ | return qe_invalid; | |
| 19248 | } | ||
| 19249 | 414 | } | |
| 19250 | |||
| 19251 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 414 times.
|
414 | if (should_skip) |
| 19252 | ✗ | return 0; | |
| 19253 | |||
| 19254 | 414 | memcpy(&zcheats, &tempzcheats, sizeof(tempzcheats)); | |
| 19255 | 414 | Header->data_flags[ZQ_CHEATS2]=temp_use_cheats; | |
| 19256 | |||
| 19257 | 414 | return 0; | |
| 19258 | 414 | } | |
| 19259 | |||
| 19260 | 288 | int32_t readinitdata_old(PACKFILE *f, zquestheader *Header, word s_version, word s_cversion, zinitdata& temp_zinit) | |
| 19261 | { | ||
| 19262 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 265 times.
|
288 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_initdata); |
| 19263 | |||
| 19264 | int32_t dummy; | ||
| 19265 | byte padding, tempbyte; | ||
| 19266 | |||
| 19267 | // Legacy item properties (now integrated into itemdata) | ||
| 19268 | byte sword_hearts[4]; | ||
| 19269 | byte beam_hearts[4]; | ||
| 19270 | 288 | byte beam_percent=0; | |
| 19271 | word beam_power[4]; | ||
| 19272 | 288 | byte hookshot_length=99; | |
| 19273 | 288 | byte hookshot_links=100; | |
| 19274 | 288 | byte longshot_length=99; | |
| 19275 | 288 | byte longshot_links=100; | |
| 19276 | 288 | byte moving_fairy_hearts=3; | |
| 19277 | 288 | byte moving_fairy_heart_percent=0; | |
| 19278 | 288 | byte stationary_fairy_hearts=3; | |
| 19279 | 288 | byte stationary_fairy_heart_percent=0; | |
| 19280 | 288 | byte moving_fairy_magic=0; | |
| 19281 | 288 | byte moving_fairy_magic_percent=0; | |
| 19282 | 288 | byte stationary_fairy_magic=0; | |
| 19283 | 288 | byte stationary_fairy_magic_percent=0; | |
| 19284 | 288 | byte blue_potion_hearts=100; | |
| 19285 | 288 | byte blue_potion_heart_percent=1; | |
| 19286 | 288 | byte red_potion_hearts=100; | |
| 19287 | 288 | byte red_potion_heart_percent=1; | |
| 19288 | 288 | byte blue_potion_magic=100; | |
| 19289 | 288 | byte blue_potion_magic_percent=1; | |
| 19290 | 288 | byte red_potion_magic=100; | |
| 19291 | 288 | byte red_potion_magic_percent=1; | |
| 19292 | |||
| 19293 | 288 | byte bomb_ratio = 4; | |
| 19294 | |||
| 19295 | 288 | subscr_mode = 0; | |
| 19296 | |||
| 19297 | /* HIGHLY UNORTHODOX UPDATING THING, by L | ||
| 19298 | * This fixes quests made before revision 277 (such as the 'Lost Isle Build'), | ||
| 19299 | * where the speed of Pols Voice changed. It also coincided with V_INITDATA | ||
| 19300 | * changing from 13 to 14. | ||
| 19301 | */ | ||
| 19302 |
2/2✓ Branch 0 taken 206 times.
✓ Branch 1 taken 82 times.
|
288 | if(s_version < 14) |
| 19303 | 82 | fixpolsvoice=true; | |
| 19304 | |||
| 19305 | /* End highly unorthodox updating thing */ | ||
| 19306 | |||
| 19307 |
4/4✓ Branch 0 taken 206 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 95 times.
✓ Branch 3 taken 111 times.
|
288 | if(s_version >= 15 && get_bit(deprecated_rules, 27)) // The int16_t-lived rule, qr_JUMPHEROLAYER3 |
| 19308 | 111 | temp_zinit.jump_hero_layer_threshold=0; | |
| 19309 | |||
| 19310 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 206 times.
|
288 | if(s_version >= 10) |
| 19311 | { | ||
| 19312 | char temp; | ||
| 19313 | |||
| 19314 | //new-style items | ||
| 19315 |
2/2✓ Branch 0 taken 52736 times.
✓ Branch 1 taken 206 times.
|
52942 | for(int32_t j=0; j<256; j++) |
| 19316 | { | ||
| 19317 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52736 times.
|
52736 | if(!p_getc(&temp,f)) |
| 19318 | ✗ | return qe_invalid; | |
| 19319 | |||
| 19320 | 52736 | temp_zinit.set_item(j, temp != 0); | |
| 19321 | 52736 | } | |
| 19322 | 206 | } | |
| 19323 | |||
| 19324 |
5/6✓ Branch 0 taken 23 times.
✓ Branch 1 taken 265 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 18 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
288 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>26))) |
| 19325 | { | ||
| 19326 | char temp; | ||
| 19327 | |||
| 19328 | //finally... section data | ||
| 19329 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 265 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
275 | if((Header->zelda_version > 0x192)|| |
| 19330 | //new only | ||
| 19331 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | ((Header->zelda_version == 0x192)&&(Header->build>173))) |
| 19332 | { | ||
| 19333 | //OLD-style items... sigh | ||
| 19334 |
2/2✓ Branch 0 taken 206 times.
✓ Branch 1 taken 60 times.
|
266 | if(s_version < 10) |
| 19335 | { | ||
| 19336 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19337 | { | ||
| 19338 | ✗ | return qe_invalid; | |
| 19339 | } | ||
| 19340 | |||
| 19341 | 60 | temp_zinit.set_item(iRaft, temp != 0); | |
| 19342 | |||
| 19343 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19344 | { | ||
| 19345 | ✗ | return qe_invalid; | |
| 19346 | } | ||
| 19347 | |||
| 19348 | 60 | temp_zinit.set_item(iLadder, temp != 0); | |
| 19349 | |||
| 19350 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19351 | { | ||
| 19352 | ✗ | return qe_invalid; | |
| 19353 | } | ||
| 19354 | |||
| 19355 | 60 | temp_zinit.set_item(iBook, temp != 0); | |
| 19356 | |||
| 19357 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19358 | { | ||
| 19359 | ✗ | return qe_invalid; | |
| 19360 | } | ||
| 19361 | |||
| 19362 | 60 | temp_zinit.set_item(iMKey, temp != 0); | |
| 19363 | |||
| 19364 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19365 | { | ||
| 19366 | ✗ | return qe_invalid; | |
| 19367 | } | ||
| 19368 | |||
| 19369 | 60 | temp_zinit.set_item(iFlippers, temp != 0); | |
| 19370 | |||
| 19371 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19372 | { | ||
| 19373 | ✗ | return qe_invalid; | |
| 19374 | } | ||
| 19375 | |||
| 19376 | 60 | temp_zinit.set_item(iBoots, temp != 0); | |
| 19377 | 60 | } | |
| 19378 | 266 | } | |
| 19379 | |||
| 19380 |
2/2✓ Branch 0 taken 206 times.
✓ Branch 1 taken 64 times.
|
270 | if(s_version < 10) |
| 19381 | { | ||
| 19382 | char tempring, tempsword, tempshield, tempwallet, tempbracelet, tempamulet, tempbow; | ||
| 19383 | |||
| 19384 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempring,f)) |
| 19385 | { | ||
| 19386 | ✗ | return qe_invalid; | |
| 19387 | } | ||
| 19388 | |||
| 19389 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempsword,f)) |
| 19390 | { | ||
| 19391 | ✗ | return qe_invalid; | |
| 19392 | } | ||
| 19393 | |||
| 19394 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempshield,f)) |
| 19395 | { | ||
| 19396 | ✗ | return qe_invalid; | |
| 19397 | } | ||
| 19398 | |||
| 19399 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempwallet,f)) |
| 19400 | { | ||
| 19401 | ✗ | return qe_invalid; | |
| 19402 | } | ||
| 19403 | |||
| 19404 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempbracelet,f)) |
| 19405 | { | ||
| 19406 | ✗ | return qe_invalid; | |
| 19407 | } | ||
| 19408 | |||
| 19409 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempamulet,f)) |
| 19410 | { | ||
| 19411 | ✗ | return qe_invalid; | |
| 19412 | } | ||
| 19413 | |||
| 19414 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempbow,f)) |
| 19415 | { | ||
| 19416 | ✗ | return qe_invalid; | |
| 19417 | } | ||
| 19418 | |||
| 19419 | //old only | ||
| 19420 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 59 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
64 | if((Header->zelda_version == 0x192)&&(Header->build<174)) |
| 19421 | { | ||
| 19422 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempring=(tempring)?(1<<(tempring-1)):0; |
| 19423 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempsword=(tempsword)?(1<<(tempsword-1)):0; |
| 19424 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | tempshield=(tempshield)?(1<<(tempshield-1)):0; |
| 19425 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempwallet=(tempwallet)?(1<<(tempwallet-1)):0; |
| 19426 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempbracelet=(tempbracelet)?(1<<(tempbracelet-1)):0; |
| 19427 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempamulet=(tempamulet)?(1<<(tempamulet-1)):0; |
| 19428 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempbow=(tempbow)?(1<<(tempbow-1)):0; |
| 19429 | 4 | } | |
| 19430 | |||
| 19431 | //rings start at level 2... wtf | ||
| 19432 | //account for this -DD | ||
| 19433 | 64 | tempring <<= 1; | |
| 19434 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_ring, tempring); | |
| 19435 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_sword, tempsword); | |
| 19436 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_shield, tempshield); | |
| 19437 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_wallet, tempwallet); | |
| 19438 | //bracelet ALSO starts at level 2 :-( -DD | ||
| 19439 | 64 | tempbracelet<<=1; | |
| 19440 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_bracelet, tempbracelet); | |
| 19441 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_amulet, tempamulet); | |
| 19442 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_bow, tempbow); | |
| 19443 | |||
| 19444 | //new only | ||
| 19445 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 59 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 1 times.
|
64 | if((Header->zelda_version == 0x192)&&(Header->build>173)) |
| 19446 | { | ||
| 19447 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 1 times.
|
33 | for(int32_t q=0; q<32; q++) |
| 19448 | { | ||
| 19449 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&padding,f)) |
| 19450 | { | ||
| 19451 | ✗ | return qe_invalid; | |
| 19452 | } | ||
| 19453 | 32 | } | |
| 19454 | 1 | } | |
| 19455 | |||
| 19456 | char tempcandle, tempboomerang, temparrow, tempwhistle; | ||
| 19457 | |||
| 19458 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempcandle,f)) |
| 19459 | { | ||
| 19460 | ✗ | return qe_invalid; | |
| 19461 | } | ||
| 19462 | |||
| 19463 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempboomerang,f)) |
| 19464 | { | ||
| 19465 | ✗ | return qe_invalid; | |
| 19466 | } | ||
| 19467 | |||
| 19468 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&temparrow,f)) |
| 19469 | { | ||
| 19470 | ✗ | return qe_invalid; | |
| 19471 | } | ||
| 19472 | |||
| 19473 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&temp,f)) |
| 19474 | { | ||
| 19475 | ✗ | return qe_invalid; | |
| 19476 | } | ||
| 19477 | |||
| 19478 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_potion, temp); | |
| 19479 | |||
| 19480 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempwhistle,f)) |
| 19481 | { | ||
| 19482 | ✗ | return qe_invalid; | |
| 19483 | } | ||
| 19484 | |||
| 19485 | //old only | ||
| 19486 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 59 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
64 | if((Header->zelda_version == 0x192)&&(Header->build<174)) |
| 19487 | { | ||
| 19488 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempcandle=(tempcandle)?(1<<(tempcandle-1)):0; |
| 19489 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempboomerang=(tempboomerang)?(1<<(tempboomerang-1)):0; |
| 19490 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | temparrow=(temparrow)?(1<<(temparrow-1)):0; |
| 19491 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempwhistle=(tempwhistle)?(1<<(tempwhistle-1)):0; |
| 19492 | 4 | } | |
| 19493 | |||
| 19494 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_candle, tempcandle); | |
| 19495 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_brang, tempboomerang); | |
| 19496 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_arrow, temparrow); | |
| 19497 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_whistle, tempwhistle); | |
| 19498 | //What about the potion...? | ||
| 19499 | |||
| 19500 | 64 | } | |
| 19501 | |||
| 19502 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 253 times.
|
270 | if(s_version < 29) |
| 19503 | { | ||
| 19504 | //Oh sure, stick these IN THE MIDDLE OF THE ITEMS, just to make me want | ||
| 19505 | //to jab out my eye... | ||
| 19506 |
1/2✓ Branch 0 taken 253 times.
✗ Branch 1 not taken.
|
253 | if(!p_getc(&padding,f)) |
| 19507 | ✗ | return qe_invalid; | |
| 19508 | 253 | temp_zinit.counter[crBOMBS] = padding; | |
| 19509 | |||
| 19510 |
1/2✓ Branch 0 taken 253 times.
✗ Branch 1 not taken.
|
253 | if(!p_getc(&padding,f)) |
| 19511 | ✗ | return qe_invalid; | |
| 19512 | 253 | temp_zinit.counter[crSBOMBS] = padding; | |
| 19513 | 253 | } | |
| 19514 | |||
| 19515 | //Back to more OLD item code | ||
| 19516 |
2/2✓ Branch 0 taken 206 times.
✓ Branch 1 taken 64 times.
|
270 | if(s_version < 10) |
| 19517 | { | ||
| 19518 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 59 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
69 | if((Header->zelda_version > 0x192)|| |
| 19519 | //new only | ||
| 19520 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | ((Header->zelda_version == 0x192)&&(Header->build>173))) |
| 19521 | { | ||
| 19522 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19523 | { | ||
| 19524 | ✗ | return qe_invalid; | |
| 19525 | } | ||
| 19526 | |||
| 19527 | 60 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_wand, temp); | |
| 19528 | |||
| 19529 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19530 | { | ||
| 19531 | ✗ | return qe_invalid; | |
| 19532 | } | ||
| 19533 | |||
| 19534 | 60 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_letter, temp); | |
| 19535 | |||
| 19536 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19537 | { | ||
| 19538 | ✗ | return qe_invalid; | |
| 19539 | } | ||
| 19540 | |||
| 19541 | 60 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_lens, temp); | |
| 19542 | |||
| 19543 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19544 | { | ||
| 19545 | ✗ | return qe_invalid; | |
| 19546 | } | ||
| 19547 | |||
| 19548 | 60 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_hookshot, temp); | |
| 19549 | |||
| 19550 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19551 | { | ||
| 19552 | ✗ | return qe_invalid; | |
| 19553 | } | ||
| 19554 | |||
| 19555 | 60 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_bait, temp); | |
| 19556 | |||
| 19557 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19558 | { | ||
| 19559 | ✗ | return qe_invalid; | |
| 19560 | } | ||
| 19561 | |||
| 19562 | 60 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_hammer, temp); | |
| 19563 | |||
| 19564 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19565 | { | ||
| 19566 | ✗ | return qe_invalid; | |
| 19567 | } | ||
| 19568 | |||
| 19569 | 60 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_divinefire, temp); | |
| 19570 | |||
| 19571 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19572 | { | ||
| 19573 | ✗ | return qe_invalid; | |
| 19574 | } | ||
| 19575 | |||
| 19576 | 60 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_divineescape, temp); | |
| 19577 | |||
| 19578 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19579 | { | ||
| 19580 | ✗ | return qe_invalid; | |
| 19581 | } | ||
| 19582 | |||
| 19583 | 60 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_divineprotection, temp); | |
| 19584 | |||
| 19585 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19586 | { | ||
| 19587 | ✗ | return qe_invalid; | |
| 19588 | } | ||
| 19589 | |||
| 19590 |
2/2✓ Branch 0 taken 59 times.
✓ Branch 1 taken 1 times.
|
60 | if(Header->zelda_version == 0x192) |
| 19591 | { | ||
| 19592 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 1 times.
|
33 | for(int32_t q=0; q<32; q++) |
| 19593 | { | ||
| 19594 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&padding,f)) |
| 19595 | { | ||
| 19596 | ✗ | return qe_invalid; | |
| 19597 | } | ||
| 19598 | 32 | } | |
| 19599 | 1 | } | |
| 19600 | 60 | } | |
| 19601 | 64 | } | |
| 19602 | |||
| 19603 | //old only | ||
| 19604 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 265 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
270 | if((Header->zelda_version == 0x192)&&(Header->build<174)) |
| 19605 | { | ||
| 19606 | byte equipment, tmpitm; //bit flags | ||
| 19607 | |||
| 19608 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if(!p_getc(&equipment,f)) |
| 19609 | { | ||
| 19610 | ✗ | return qe_invalid; | |
| 19611 | } | ||
| 19612 | |||
| 19613 | 4 | temp_zinit.set_item(iRaft, get_bit(&equipment, idE_RAFT)!=0); | |
| 19614 | 4 | temp_zinit.set_item(iLadder, get_bit(&equipment, idE_LADDER)!=0); | |
| 19615 | 4 | temp_zinit.set_item(iBook, get_bit(&equipment, idE_BOOK)!=0); | |
| 19616 | 4 | temp_zinit.set_item(iMKey, get_bit(&equipment, idE_KEY)!=0); | |
| 19617 | 4 | temp_zinit.set_item(iFlippers, get_bit(&equipment, idE_FLIPPERS)!=0); | |
| 19618 | 4 | temp_zinit.set_item(iBoots, get_bit(&equipment, idE_BOOTS)!=0); | |
| 19619 | |||
| 19620 | |||
| 19621 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if(!p_getc(&tmpitm,f)) |
| 19622 | { | ||
| 19623 | ✗ | return qe_invalid; | |
| 19624 | } | ||
| 19625 | |||
| 19626 | 4 | temp_zinit.set_item(iWand, get_bit(&tmpitm, idI_WAND)!=0); | |
| 19627 | 4 | temp_zinit.set_item(iLetter, get_bit(&tmpitm, idI_LETTER)!=0); | |
| 19628 | 4 | temp_zinit.set_item(iLens, get_bit(&tmpitm, idI_LENS)!=0); | |
| 19629 | 4 | temp_zinit.set_item(iHookshot, get_bit(&tmpitm, idI_HOOKSHOT)!=0); | |
| 19630 | 4 | temp_zinit.set_item(iBait, get_bit(&tmpitm, idI_BAIT)!=0); | |
| 19631 | 4 | temp_zinit.set_item(iHammer, get_bit(&tmpitm, idI_HAMMER)!=0); | |
| 19632 | 4 | } | |
| 19633 | |||
| 19634 |
1/2✓ Branch 0 taken 270 times.
✗ Branch 1 not taken.
|
270 | if(!p_getc(&tempbyte,f)) |
| 19635 | ✗ | return qe_invalid; | |
| 19636 | 270 | temp_zinit.mcounter[crLIFE] = tempbyte; | |
| 19637 | |||
| 19638 | |||
| 19639 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 206 times.
|
270 | if(s_version < 14) |
| 19640 | { | ||
| 19641 | byte temphp; | ||
| 19642 | |||
| 19643 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&temphp,f)) |
| 19644 | { | ||
| 19645 | ✗ | return qe_invalid; | |
| 19646 | } | ||
| 19647 | |||
| 19648 | 64 | temp_zinit.counter[crLIFE]=temphp; | |
| 19649 | |||
| 19650 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&temphp,f)) |
| 19651 | { | ||
| 19652 | ✗ | return qe_invalid; | |
| 19653 | } | ||
| 19654 | |||
| 19655 | 64 | temp_zinit.cont_heart=temphp; | |
| 19656 | 64 | } | |
| 19657 | else | ||
| 19658 | { | ||
| 19659 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if(!p_igetw(&temp_zinit.counter[crLIFE],f)) |
| 19660 | { | ||
| 19661 | ✗ | return qe_invalid; | |
| 19662 | } | ||
| 19663 | |||
| 19664 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if(!p_igetw(&temp_zinit.cont_heart,f)) |
| 19665 | { | ||
| 19666 | ✗ | return qe_invalid; | |
| 19667 | } | ||
| 19668 | } | ||
| 19669 | |||
| 19670 |
1/2✓ Branch 0 taken 270 times.
✗ Branch 1 not taken.
|
270 | if(!p_getc(&temp_zinit.hcp,f)) |
| 19671 | { | ||
| 19672 | ✗ | return qe_invalid; | |
| 19673 | } | ||
| 19674 | |||
| 19675 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 206 times.
|
270 | if(s_version >= 14) |
| 19676 | { | ||
| 19677 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if(!p_getc(&temp_zinit.hcp_per_hc,f)) |
| 19678 | { | ||
| 19679 | ✗ | return qe_invalid; | |
| 19680 | } | ||
| 19681 | |||
| 19682 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if(s_version<16) // July 2007 |
| 19683 | { | ||
| 19684 | ✗ | if(get_qr(qr_BRANGPICKUP+1)) | |
| 19685 | ✗ | temp_zinit.hcp_per_hc = 0xFF; | |
| 19686 | |||
| 19687 | //Dispose of legacy rule | ||
| 19688 | ✗ | set_qr(qr_BRANGPICKUP+1, 0); | |
| 19689 | ✗ | } | |
| 19690 | 206 | } | |
| 19691 | |||
| 19692 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 253 times.
|
270 | if(s_version < 29) |
| 19693 | { | ||
| 19694 |
1/2✓ Branch 0 taken 253 times.
✗ Branch 1 not taken.
|
253 | if(!p_getc(&padding,f)) |
| 19695 | ✗ | return qe_invalid; | |
| 19696 | 253 | temp_zinit.mcounter[crBOMBS] = padding; | |
| 19697 | 253 | } | |
| 19698 | |||
| 19699 |
1/2✓ Branch 0 taken 270 times.
✗ Branch 1 not taken.
|
270 | if(!p_getc(&temp_zinit.counter[crKEYS],f)) |
| 19700 | { | ||
| 19701 | ✗ | return qe_invalid; | |
| 19702 | } | ||
| 19703 | |||
| 19704 |
1/2✓ Branch 0 taken 270 times.
✗ Branch 1 not taken.
|
270 | if(!p_igetw(&temp_zinit.counter[crMONEY],f)) |
| 19705 | { | ||
| 19706 | ✗ | return qe_invalid; | |
| 19707 | } | ||
| 19708 | |||
| 19709 |
1/2✓ Branch 0 taken 270 times.
✗ Branch 1 not taken.
|
270 | if(!p_getc(&tempbyte,f)) |
| 19710 | ✗ | return qe_invalid; | |
| 19711 |
2/2✓ Branch 0 taken 2160 times.
✓ Branch 1 taken 270 times.
|
2430 | for(int q = 0; q < 8; ++q) |
| 19712 | 2160 | set_bit(temp_zinit.mcguffin, q+1, get_bitl(tempbyte, q)); | |
| 19713 | |||
| 19714 |
3/6✓ Branch 0 taken 64 times.
✓ Branch 1 taken 206 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 64 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
270 | if(s_version>12 || (Header->zelda_version == 0x211 && Header->build == 18)) |
| 19715 | { | ||
| 19716 |
2/2✓ Branch 0 taken 13184 times.
✓ Branch 1 taken 206 times.
|
13390 | for(int32_t i=0; i<64; i++) |
| 19717 | { | ||
| 19718 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13184 times.
|
13184 | if(!p_getc(&temp_zinit.map[i],f)) |
| 19719 | { | ||
| 19720 | ✗ | return qe_invalid; | |
| 19721 | } | ||
| 19722 | 13184 | } | |
| 19723 | |||
| 19724 |
2/2✓ Branch 0 taken 13184 times.
✓ Branch 1 taken 206 times.
|
13390 | for(int32_t i=0; i<64; i++) |
| 19725 | { | ||
| 19726 |
1/2✓ Branch 0 taken 13184 times.
✗ Branch 1 not taken.
|
13184 | if(!p_getc(&temp_zinit.compass[i],f)) |
| 19727 | { | ||
| 19728 | ✗ | return qe_invalid; | |
| 19729 | } | ||
| 19730 | 13184 | } | |
| 19731 | 206 | } | |
| 19732 | else | ||
| 19733 | { | ||
| 19734 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 64 times.
|
2112 | for(int32_t i=0; i<32; i++) |
| 19735 | { | ||
| 19736 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_getc(&temp_zinit.map[i],f)) |
| 19737 | { | ||
| 19738 | ✗ | return qe_invalid; | |
| 19739 | } | ||
| 19740 | 2048 | } | |
| 19741 | |||
| 19742 |
2/2✓ Branch 0 taken 2048 times.
✓ Branch 1 taken 64 times.
|
2112 | for(int32_t i=0; i<32; i++) |
| 19743 | { | ||
| 19744 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_getc(&temp_zinit.compass[i],f)) |
| 19745 | { | ||
| 19746 | ✗ | return qe_invalid; | |
| 19747 | } | ||
| 19748 | 2048 | } | |
| 19749 | } | ||
| 19750 | |||
| 19751 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 265 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
275 | if((Header->zelda_version > 0x192)|| |
| 19752 | //new only | ||
| 19753 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | ((Header->zelda_version == 0x192)&&(Header->build>173))) |
| 19754 | { | ||
| 19755 |
3/6✓ Branch 0 taken 60 times.
✓ Branch 1 taken 206 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 60 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
266 | if(s_version>12 || (Header->zelda_version == 0x211 && Header->build == 18)) |
| 19756 | { | ||
| 19757 |
2/2✓ Branch 0 taken 13184 times.
✓ Branch 1 taken 206 times.
|
13390 | for(int32_t i=0; i<64; i++) |
| 19758 | { | ||
| 19759 |
1/2✓ Branch 0 taken 13184 times.
✗ Branch 1 not taken.
|
13184 | if(!p_getc(&temp_zinit.boss_key[i],f)) |
| 19760 | { | ||
| 19761 | ✗ | return qe_invalid; | |
| 19762 | } | ||
| 19763 | 13184 | } | |
| 19764 | 206 | } | |
| 19765 | else | ||
| 19766 | { | ||
| 19767 |
2/2✓ Branch 0 taken 1920 times.
✓ Branch 1 taken 60 times.
|
1980 | for(int32_t i=0; i<32; i++) |
| 19768 | { | ||
| 19769 |
1/2✓ Branch 0 taken 1920 times.
✗ Branch 1 not taken.
|
1920 | if(!p_getc(&temp_zinit.boss_key[i],f)) |
| 19770 | { | ||
| 19771 | ✗ | return qe_invalid; | |
| 19772 | } | ||
| 19773 | 1920 | } | |
| 19774 | } | ||
| 19775 | 266 | } | |
| 19776 | |||
| 19777 | byte tmpmisc[16]; | ||
| 19778 |
2/2✓ Branch 0 taken 4320 times.
✓ Branch 1 taken 270 times.
|
4590 | for(int32_t i=0; i<16; i++) |
| 19779 |
1/2✓ Branch 0 taken 4320 times.
✗ Branch 1 not taken.
|
4320 | if(!p_getc(&tmpmisc[i],f)) |
| 19780 | ✗ | return qe_invalid; | |
| 19781 | 270 | temp_zinit.flags.set(INIT_FL_CONTPERCENT,get_bit(tmpmisc,0)); | |
| 19782 | 270 | temp_zinit.magicdrainrate = get_bit(tmpmisc,1) ? 1 : 2; //Double Magic flag | |
| 19783 | 270 | temp_zinit.flags.set(INIT_FL_CANSLASH,get_bit(tmpmisc,2)); | |
| 19784 | |||
| 19785 |
4/4✓ Branch 0 taken 206 times.
✓ Branch 1 taken 64 times.
✓ Branch 2 taken 256 times.
✓ Branch 3 taken 64 times.
|
526 | if(s_version < 15) for(int32_t i=0; i<4; i++) |
| 19786 |
1/2✓ Branch 0 taken 256 times.
✗ Branch 1 not taken.
|
256 | if(!p_getc(&sword_hearts[i],f)) |
| 19787 | 64 | return qe_invalid; | |
| 19788 | |||
| 19789 |
1/2✓ Branch 0 taken 270 times.
✗ Branch 1 not taken.
|
270 | if(!p_getc(&temp_zinit.last_map,f)) |
| 19790 | { | ||
| 19791 | ✗ | return qe_invalid; | |
| 19792 | } | ||
| 19793 | |||
| 19794 |
1/2✓ Branch 0 taken 270 times.
✗ Branch 1 not taken.
|
270 | if(!p_getc(&temp_zinit.last_screen,f)) |
| 19795 | { | ||
| 19796 | ✗ | return qe_invalid; | |
| 19797 | } | ||
| 19798 | |||
| 19799 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 206 times.
|
270 | if(s_version < 14) |
| 19800 | { | ||
| 19801 | byte tempmp; | ||
| 19802 | |||
| 19803 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempmp,f)) |
| 19804 | { | ||
| 19805 | ✗ | return qe_invalid; | |
| 19806 | } | ||
| 19807 | |||
| 19808 | 64 | temp_zinit.mcounter[crMAGIC]=tempmp; | |
| 19809 | |||
| 19810 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempmp,f)) |
| 19811 | { | ||
| 19812 | ✗ | return qe_invalid; | |
| 19813 | } | ||
| 19814 | |||
| 19815 | 64 | temp_zinit.counter[crMAGIC]=tempmp; | |
| 19816 | 64 | } | |
| 19817 | else | ||
| 19818 | { | ||
| 19819 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if(!p_igetw(&temp_zinit.mcounter[crMAGIC],f)) |
| 19820 | { | ||
| 19821 | ✗ | return qe_invalid; | |
| 19822 | } | ||
| 19823 | |||
| 19824 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if(!p_igetw(&temp_zinit.counter[crMAGIC],f)) |
| 19825 | { | ||
| 19826 | ✗ | return qe_invalid; | |
| 19827 | } | ||
| 19828 | } | ||
| 19829 | |||
| 19830 | |||
| 19831 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 206 times.
|
270 | if(s_version < 15) |
| 19832 | { | ||
| 19833 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 64 times.
|
64 | if(s_version < 12) |
| 19834 | { | ||
| 19835 | 64 | temp_zinit.mcounter[crMAGIC]*=32; | |
| 19836 | 64 | temp_zinit.counter[crMAGIC]*=32; | |
| 19837 | 64 | } | |
| 19838 | |||
| 19839 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 64 times.
|
320 | for(int32_t i=0; i<4; i++) |
| 19840 | { | ||
| 19841 |
1/2✓ Branch 0 taken 256 times.
✗ Branch 1 not taken.
|
256 | if(!p_getc(&beam_hearts[i],f)) |
| 19842 | { | ||
| 19843 | ✗ | return qe_invalid; | |
| 19844 | } | ||
| 19845 | 256 | } | |
| 19846 | |||
| 19847 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&beam_percent,f)) |
| 19848 | { | ||
| 19849 | ✗ | return qe_invalid; | |
| 19850 | } | ||
| 19851 | 64 | } | |
| 19852 | else | ||
| 19853 | { | ||
| 19854 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if(!p_getc(&temp_zinit.bomb_ratio,f)) |
| 19855 | ✗ | return qe_invalid; | |
| 19856 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if(temp_zinit.bomb_ratio < 1) |
| 19857 | ✗ | temp_zinit.bomb_ratio = 1; | |
| 19858 | 206 | else bomb_ratio = temp_zinit.bomb_ratio; //jank | |
| 19859 | } | ||
| 19860 | |||
| 19861 |
2/2✓ Branch 0 taken 206 times.
✓ Branch 1 taken 64 times.
|
270 | if(s_version < 15) |
| 19862 | { | ||
| 19863 | byte tempbp; | ||
| 19864 | |||
| 19865 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 64 times.
|
320 | for(int32_t i=0; i<4; i++) |
| 19866 | { | ||
| 19867 |
2/4✓ Branch 0 taken 256 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 256 times.
✗ Branch 3 not taken.
|
256 | if(!(s_version < 14 ? p_getc(&tempbp,f) : p_igetw(&tempbp,f))) |
| 19868 | { | ||
| 19869 | ✗ | return qe_invalid; | |
| 19870 | } | ||
| 19871 | |||
| 19872 | 256 | beam_power[i]=tempbp; | |
| 19873 | 256 | } | |
| 19874 | |||
| 19875 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&hookshot_links,f)) |
| 19876 | { | ||
| 19877 | ✗ | return qe_invalid; | |
| 19878 | } | ||
| 19879 | |||
| 19880 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(s_version>6) |
| 19881 | { | ||
| 19882 | ✗ | if(!p_getc(&hookshot_length,f)) | |
| 19883 | { | ||
| 19884 | ✗ | return qe_invalid; | |
| 19885 | } | ||
| 19886 | |||
| 19887 | ✗ | if(!p_getc(&longshot_links,f)) | |
| 19888 | { | ||
| 19889 | ✗ | return qe_invalid; | |
| 19890 | } | ||
| 19891 | |||
| 19892 | ✗ | if(!p_getc(&longshot_length,f)) | |
| 19893 | { | ||
| 19894 | ✗ | return qe_invalid; | |
| 19895 | } | ||
| 19896 | ✗ | } | |
| 19897 | 64 | } | |
| 19898 | |||
| 19899 |
1/2✓ Branch 0 taken 270 times.
✗ Branch 1 not taken.
|
270 | if(!p_getc(&temp_zinit.msg_more_x,f)) |
| 19900 | { | ||
| 19901 | ✗ | return qe_invalid; | |
| 19902 | } | ||
| 19903 | |||
| 19904 |
1/2✓ Branch 0 taken 270 times.
✗ Branch 1 not taken.
|
270 | if(!p_getc(&temp_zinit.msg_more_y,f)) |
| 19905 | { | ||
| 19906 | ✗ | return qe_invalid; | |
| 19907 | } | ||
| 19908 | |||
| 19909 |
1/2✓ Branch 0 taken 270 times.
✗ Branch 1 not taken.
|
270 | if(!p_getc(&subscr_mode,f)) |
| 19910 | ✗ | return qe_invalid; | |
| 19911 | |||
| 19912 | //old only | ||
| 19913 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 265 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
270 | if((Header->zelda_version == 0x192)&&(Header->build<174)) |
| 19914 | { | ||
| 19915 |
2/2✓ Branch 0 taken 128 times.
✓ Branch 1 taken 4 times.
|
132 | for(int32_t i=0; i<32; i++) |
| 19916 | { | ||
| 19917 |
1/2✓ Branch 0 taken 128 times.
✗ Branch 1 not taken.
|
128 | if(!p_getc(&temp_zinit.boss_key[i],f)) |
| 19918 | { | ||
| 19919 | ✗ | return qe_invalid; | |
| 19920 | } | ||
| 19921 | 128 | } | |
| 19922 | 4 | } | |
| 19923 | |||
| 19924 |
5/6✓ Branch 0 taken 5 times.
✓ Branch 1 taken 265 times.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 4 times.
|
270 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>173))) //new only |
| 19925 | { | ||
| 19926 |
2/2✓ Branch 0 taken 60 times.
✓ Branch 1 taken 206 times.
|
266 | if(s_version <= 10) |
| 19927 | { | ||
| 19928 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&tempbyte,f)) |
| 19929 | { | ||
| 19930 | ✗ | return qe_invalid; | |
| 19931 | } | ||
| 19932 | |||
| 19933 | 60 | temp_zinit.start_dmap = (word)tempbyte; | |
| 19934 | 60 | } | |
| 19935 | else | ||
| 19936 | { | ||
| 19937 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if(!p_igetw(&temp_zinit.start_dmap,f)) |
| 19938 | { | ||
| 19939 | ✗ | return qe_invalid; | |
| 19940 | } | ||
| 19941 | } | ||
| 19942 | |||
| 19943 |
1/2✓ Branch 0 taken 266 times.
✗ Branch 1 not taken.
|
266 | if(!p_getc(&temp_zinit.heroAnimationStyle,f)) |
| 19944 | { | ||
| 19945 | ✗ | return qe_invalid; | |
| 19946 | } | ||
| 19947 | 266 | } | |
| 19948 | |||
| 19949 |
4/4✓ Branch 0 taken 206 times.
✓ Branch 1 taken 64 times.
✓ Branch 2 taken 17 times.
✓ Branch 3 taken 189 times.
|
270 | if(s_version>1 && s_version < 29) |
| 19950 | { | ||
| 19951 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(!p_getc(&padding,f)) |
| 19952 | ✗ | return qe_invalid; | |
| 19953 | 189 | temp_zinit.counter[crARROWS] = padding; | |
| 19954 | |||
| 19955 |
1/2✓ Branch 0 taken 189 times.
✗ Branch 1 not taken.
|
189 | if(!p_getc(&padding,f)) |
| 19956 | ✗ | return qe_invalid; | |
| 19957 | 189 | temp_zinit.mcounter[crARROWS] = padding; | |
| 19958 | 189 | } | |
| 19959 | |||
| 19960 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 206 times.
|
270 | if(s_version>2) |
| 19961 | { | ||
| 19962 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 206 times.
|
206 | if(s_version <= 10) |
| 19963 | { | ||
| 19964 | ✗ | for(int32_t i=0; i<OLDMAXLEVELS; i++) | |
| 19965 | { | ||
| 19966 | ✗ | if(!p_getc(&(temp_zinit.level_keys[i]),f)) | |
| 19967 | { | ||
| 19968 | ✗ | return qe_invalid; | |
| 19969 | } | ||
| 19970 | ✗ | } | |
| 19971 | ✗ | } | |
| 19972 | else | ||
| 19973 | { | ||
| 19974 |
2/2✓ Branch 0 taken 105472 times.
✓ Branch 1 taken 206 times.
|
105678 | for(int32_t i=0; i<MAXLEVELS; i++) |
| 19975 | { | ||
| 19976 |
1/2✓ Branch 0 taken 105472 times.
✗ Branch 1 not taken.
|
105472 | if(!p_getc(&(temp_zinit.level_keys[i]),f)) |
| 19977 | { | ||
| 19978 | ✗ | return qe_invalid; | |
| 19979 | } | ||
| 19980 | 105472 | } | |
| 19981 | } | ||
| 19982 | 206 | } | |
| 19983 | |||
| 19984 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 206 times.
|
270 | if(s_version>3) |
| 19985 | { | ||
| 19986 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if(!p_igetw(&temp_zinit.ss_grid_x,f)) |
| 19987 | { | ||
| 19988 | ✗ | return qe_invalid; | |
| 19989 | } | ||
| 19990 | |||
| 19991 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if(!p_igetw(&temp_zinit.ss_grid_y,f)) |
| 19992 | { | ||
| 19993 | ✗ | return qe_invalid; | |
| 19994 | } | ||
| 19995 | |||
| 19996 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if(!p_igetw(&temp_zinit.ss_grid_xofs,f)) |
| 19997 | { | ||
| 19998 | ✗ | return qe_invalid; | |
| 19999 | } | ||
| 20000 | |||
| 20001 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if(!p_igetw(&temp_zinit.ss_grid_yofs,f)) |
| 20002 | { | ||
| 20003 | ✗ | return qe_invalid; | |
| 20004 | } | ||
| 20005 | |||
| 20006 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if(!p_igetw(&temp_zinit.ss_grid_color,f)) |
| 20007 | { | ||
| 20008 | ✗ | return qe_invalid; | |
| 20009 | } | ||
| 20010 | |||
| 20011 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if(!p_igetw(&temp_zinit.ss_bbox_1_color,f)) |
| 20012 | { | ||
| 20013 | ✗ | return qe_invalid; | |
| 20014 | } | ||
| 20015 | |||
| 20016 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if(!p_igetw(&temp_zinit.ss_bbox_2_color,f)) |
| 20017 | { | ||
| 20018 | ✗ | return qe_invalid; | |
| 20019 | } | ||
| 20020 | |||
| 20021 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if(!p_igetw(&temp_zinit.ss_flags,f)) |
| 20022 | { | ||
| 20023 | ✗ | return qe_invalid; | |
| 20024 | } | ||
| 20025 | |||
| 20026 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 206 times.
|
206 | temp_zinit.ss_grid_x=zc_max(temp_zinit.ss_grid_x,1); |
| 20027 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 206 times.
|
206 | temp_zinit.ss_grid_y=zc_max(temp_zinit.ss_grid_y,1); |
| 20028 | 206 | } | |
| 20029 | |||
| 20030 |
3/4✓ Branch 0 taken 206 times.
✓ Branch 1 taken 64 times.
✓ Branch 2 taken 206 times.
✗ Branch 3 not taken.
|
270 | if(s_version>4 && s_version<15) |
| 20031 | { | ||
| 20032 | ✗ | if(!p_getc(&moving_fairy_hearts,f)) | |
| 20033 | { | ||
| 20034 | ✗ | return qe_invalid; | |
| 20035 | } | ||
| 20036 | |||
| 20037 | ✗ | if(!p_getc(&moving_fairy_heart_percent,f)) | |
| 20038 | { | ||
| 20039 | ✗ | return qe_invalid; | |
| 20040 | } | ||
| 20041 | ✗ | } | |
| 20042 | |||
| 20043 |
3/4✓ Branch 0 taken 206 times.
✓ Branch 1 taken 64 times.
✓ Branch 2 taken 206 times.
✗ Branch 3 not taken.
|
270 | if(s_version>5 && s_version < 10) |
| 20044 | { | ||
| 20045 | ✗ | if(!p_getc(&temp,f)) | |
| 20046 | { | ||
| 20047 | ✗ | return qe_invalid; | |
| 20048 | } | ||
| 20049 | |||
| 20050 | ✗ | addOldStyleFamily(&temp_zinit, itemsbuf, itype_quiver, temp); | |
| 20051 | ✗ | } | |
| 20052 | |||
| 20053 |
3/4✓ Branch 0 taken 206 times.
✓ Branch 1 taken 64 times.
✓ Branch 2 taken 206 times.
✗ Branch 3 not taken.
|
270 | if(s_version>6 && s_version<15) |
| 20054 | { | ||
| 20055 | ✗ | if(!p_getc(&stationary_fairy_hearts,f)) | |
| 20056 | { | ||
| 20057 | ✗ | return qe_invalid; | |
| 20058 | } | ||
| 20059 | |||
| 20060 | ✗ | if(!p_getc(&stationary_fairy_heart_percent,f)) | |
| 20061 | { | ||
| 20062 | ✗ | return qe_invalid; | |
| 20063 | } | ||
| 20064 | |||
| 20065 | ✗ | if(!p_getc(&moving_fairy_magic,f)) | |
| 20066 | { | ||
| 20067 | ✗ | return qe_invalid; | |
| 20068 | } | ||
| 20069 | |||
| 20070 | ✗ | if(!p_getc(&moving_fairy_magic_percent,f)) | |
| 20071 | { | ||
| 20072 | ✗ | return qe_invalid; | |
| 20073 | } | ||
| 20074 | |||
| 20075 | ✗ | if(!p_getc(&stationary_fairy_magic,f)) | |
| 20076 | { | ||
| 20077 | ✗ | return qe_invalid; | |
| 20078 | } | ||
| 20079 | |||
| 20080 | ✗ | if(!p_getc(&stationary_fairy_magic_percent,f)) | |
| 20081 | { | ||
| 20082 | ✗ | return qe_invalid; | |
| 20083 | } | ||
| 20084 | |||
| 20085 | ✗ | if(!p_getc(&blue_potion_hearts,f)) | |
| 20086 | { | ||
| 20087 | ✗ | return qe_invalid; | |
| 20088 | } | ||
| 20089 | |||
| 20090 | ✗ | if(!p_getc(&blue_potion_heart_percent,f)) | |
| 20091 | { | ||
| 20092 | ✗ | return qe_invalid; | |
| 20093 | } | ||
| 20094 | |||
| 20095 | ✗ | if(!p_getc(&red_potion_hearts,f)) | |
| 20096 | { | ||
| 20097 | ✗ | return qe_invalid; | |
| 20098 | } | ||
| 20099 | |||
| 20100 | ✗ | if(!p_getc(&red_potion_heart_percent,f)) | |
| 20101 | { | ||
| 20102 | ✗ | return qe_invalid; | |
| 20103 | } | ||
| 20104 | |||
| 20105 | ✗ | if(!p_getc(&blue_potion_magic,f)) | |
| 20106 | { | ||
| 20107 | ✗ | return qe_invalid; | |
| 20108 | } | ||
| 20109 | |||
| 20110 | ✗ | if(!p_getc(&blue_potion_magic_percent,f)) | |
| 20111 | { | ||
| 20112 | ✗ | return qe_invalid; | |
| 20113 | } | ||
| 20114 | |||
| 20115 | ✗ | if(!p_getc(&red_potion_magic,f)) | |
| 20116 | { | ||
| 20117 | ✗ | return qe_invalid; | |
| 20118 | } | ||
| 20119 | |||
| 20120 | ✗ | if(!p_getc(&red_potion_magic_percent,f)) | |
| 20121 | { | ||
| 20122 | ✗ | return qe_invalid; | |
| 20123 | } | ||
| 20124 | ✗ | } | |
| 20125 | |||
| 20126 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 206 times.
|
270 | if(s_version>6) |
| 20127 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if(!p_getc(&padding,f)) |
| 20128 | ✗ | return qe_invalid; | |
| 20129 | |||
| 20130 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 206 times.
|
270 | if(s_version>7) |
| 20131 | { | ||
| 20132 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if(!p_getc(&padding,f)) |
| 20133 | { | ||
| 20134 | ✗ | return qe_invalid; | |
| 20135 | } | ||
| 20136 | 206 | } | |
| 20137 | |||
| 20138 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 206 times.
|
270 | if(s_version>8) |
| 20139 | { | ||
| 20140 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if(!p_igetw(&temp_zinit.mcounter[crMONEY],f)) |
| 20141 | { | ||
| 20142 | ✗ | return qe_invalid; | |
| 20143 | } | ||
| 20144 | |||
| 20145 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if(!p_igetw(&temp_zinit.mcounter[crKEYS],f)) |
| 20146 | { | ||
| 20147 | ✗ | return qe_invalid; | |
| 20148 | } | ||
| 20149 | 206 | } | |
| 20150 | |||
| 20151 |
2/2✓ Branch 0 taken 206 times.
✓ Branch 1 taken 64 times.
|
270 | if(s_version>16) |
| 20152 | { | ||
| 20153 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if(!p_getc(&tempbyte,f)) |
| 20154 | { | ||
| 20155 | ✗ | return qe_invalid; | |
| 20156 | } | ||
| 20157 | 206 | temp_zinit.gravity = tempbyte*100; | |
| 20158 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if(!p_igetw(&temp_zinit.terminalv,f)) |
| 20159 | { | ||
| 20160 | ✗ | return qe_invalid; | |
| 20161 | } | ||
| 20162 | |||
| 20163 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if(!p_getc(&temp_zinit.msg_speed,f)) |
| 20164 | { | ||
| 20165 | ✗ | return qe_invalid; | |
| 20166 | } | ||
| 20167 | |||
| 20168 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if(!p_getc(&padding,f)) |
| 20169 | { | ||
| 20170 | ✗ | return qe_invalid; | |
| 20171 | } | ||
| 20172 | |||
| 20173 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if(!p_getc(&temp_zinit.jump_hero_layer_threshold,f)) |
| 20174 | { | ||
| 20175 | ✗ | return qe_invalid; | |
| 20176 | } | ||
| 20177 | 206 | } | |
| 20178 |
2/2✓ Branch 0 taken 52 times.
✓ Branch 1 taken 12 times.
|
64 | else if (replay_version_check(0, 13)) |
| 20179 | 12 | temp_zinit.msg_speed = 0; | |
| 20180 | |||
| 20181 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 206 times.
|
270 | if(s_version>17) |
| 20182 | { | ||
| 20183 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if(!p_getc(&temp_zinit.msg_more_is_offset,f)) |
| 20184 | { | ||
| 20185 | ✗ | return qe_invalid; | |
| 20186 | } | ||
| 20187 | 206 | } | |
| 20188 | |||
| 20189 | //expaned init data for larger values in 2.55 | ||
| 20190 |
2/2✓ Branch 0 taken 253 times.
✓ Branch 1 taken 17 times.
|
270 | if ( s_version >= 19 ) //expand init data bombs, sbombs, and arrows to 0xFFFF |
| 20191 | { | ||
| 20192 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetw(&temp_zinit.counter[crBOMBS],f)) |
| 20193 | { | ||
| 20194 | ✗ | return qe_invalid; | |
| 20195 | } | ||
| 20196 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetw(&temp_zinit.counter[crSBOMBS],f)) |
| 20197 | { | ||
| 20198 | ✗ | return qe_invalid; | |
| 20199 | } | ||
| 20200 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetw(&temp_zinit.mcounter[crBOMBS],f)) |
| 20201 | { | ||
| 20202 | ✗ | return qe_invalid; | |
| 20203 | } | ||
| 20204 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetw(&temp_zinit.mcounter[crSBOMBS],f)) |
| 20205 | { | ||
| 20206 | ✗ | return qe_invalid; | |
| 20207 | } | ||
| 20208 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetw(&temp_zinit.counter[crARROWS],f)) |
| 20209 | { | ||
| 20210 | ✗ | return qe_invalid; | |
| 20211 | } | ||
| 20212 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetw(&temp_zinit.mcounter[crARROWS],f)) |
| 20213 | { | ||
| 20214 | ✗ | return qe_invalid; | |
| 20215 | } | ||
| 20216 | |||
| 20217 | 17 | } | |
| 20218 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 253 times.
|
270 | if ( s_version >= 20 ) |
| 20219 | { | ||
| 20220 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetw(&temp_zinit.heroStep,f)) |
| 20221 | { | ||
| 20222 | ✗ | return qe_invalid; | |
| 20223 | } | ||
| 20224 | 17 | } | |
| 20225 | else | ||
| 20226 | { | ||
| 20227 | 253 | temp_zinit.heroStep = 150; //1.5 pixels per frame | |
| 20228 | } | ||
| 20229 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 253 times.
|
270 | if ( s_version >= 21 ) |
| 20230 | { | ||
| 20231 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetw(&temp_zinit.subscrSpeed,f)) |
| 20232 | { | ||
| 20233 | ✗ | return qe_invalid; | |
| 20234 | } | ||
| 20235 | 17 | } | |
| 20236 | else | ||
| 20237 | { | ||
| 20238 | 253 | temp_zinit.subscrSpeed = 1; //3 pixels per frame | |
| 20239 | } | ||
| 20240 | //old only | ||
| 20241 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 265 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
270 | if((Header->zelda_version == 0x192)&&(Header->build<174)) |
| 20242 | { | ||
| 20243 | byte items2; | ||
| 20244 | |||
| 20245 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if(!p_getc(&items2,f)) |
| 20246 | { | ||
| 20247 | ✗ | return qe_invalid; | |
| 20248 | } | ||
| 20249 | |||
| 20250 | 4 | temp_zinit.set_item(iDivineFire, get_bit(&items2, idI_DFIRE)!=0); | |
| 20251 | 4 | temp_zinit.set_item(iDivineEscape, get_bit(&items2, idI_FWIND)!=0); | |
| 20252 | 4 | temp_zinit.set_item(iDivineProtection, get_bit(&items2, idI_NLOVE)!=0); | |
| 20253 | 4 | } | |
| 20254 | |||
| 20255 |
2/2✓ Branch 0 taken 265 times.
✓ Branch 1 taken 5 times.
|
270 | if(Header->zelda_version < 0x193) |
| 20256 | { | ||
| 20257 |
2/2✓ Branch 0 taken 480 times.
✓ Branch 1 taken 5 times.
|
485 | for(int32_t q=0; q<96; q++) |
| 20258 | { | ||
| 20259 |
1/2✓ Branch 0 taken 480 times.
✗ Branch 1 not taken.
|
480 | if(!p_getc(&padding,f)) |
| 20260 | { | ||
| 20261 | ✗ | return qe_invalid; | |
| 20262 | } | ||
| 20263 | 480 | } | |
| 20264 | |||
| 20265 | //new only | ||
| 20266 |
3/4✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 1 times.
|
5 | if((Header->zelda_version == 0x192)&&(Header->build>173)) |
| 20267 | { | ||
| 20268 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(!p_getc(&padding,f)) |
| 20269 | { | ||
| 20270 | ✗ | return qe_invalid; | |
| 20271 | } | ||
| 20272 | |||
| 20273 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(!p_getc(&padding,f)) |
| 20274 | { | ||
| 20275 | ✗ | return qe_invalid; | |
| 20276 | } | ||
| 20277 | 1 | } | |
| 20278 | 5 | } | |
| 20279 | 270 | } | |
| 20280 | |||
| 20281 |
3/6✓ Branch 0 taken 206 times.
✓ Branch 1 taken 82 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 206 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
288 | if((Header->zelda_version < 0x211)||((Header->zelda_version == 0x211)&&(Header->build<15))) |
| 20282 | { | ||
| 20283 | //temp_zinit.shield=i_smallshield; | ||
| 20284 | 82 | int32_t sshieldid = getItemID(itemsbuf, itype_shield, i_smallshield); | |
| 20285 | |||
| 20286 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | if(sshieldid != -1) |
| 20287 | 82 | temp_zinit.set_item(sshieldid, true); | |
| 20288 | 82 | } | |
| 20289 | |||
| 20290 |
5/6✓ Branch 0 taken 270 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 265 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
|
288 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<27))) |
| 20291 | { | ||
| 20292 | 18 | temp_zinit.mcounter[crLIFE]=3; | |
| 20293 | 18 | temp_zinit.counter[crLIFE]=3; | |
| 20294 | 18 | temp_zinit.cont_heart=3; | |
| 20295 | 18 | temp_zinit.mcounter[crBOMBS]=8; | |
| 20296 | 18 | } | |
| 20297 | |||
| 20298 |
5/6✓ Branch 0 taken 270 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 265 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
|
288 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<50))) |
| 20299 | { | ||
| 20300 | 18 | sword_hearts[0]=0; | |
| 20301 | 18 | sword_hearts[1]=5; | |
| 20302 | 18 | sword_hearts[2]=12; | |
| 20303 | 18 | sword_hearts[3]=21; | |
| 20304 | 18 | } | |
| 20305 | |||
| 20306 |
5/6✓ Branch 0 taken 270 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 265 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
|
288 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<51))) |
| 20307 | { | ||
| 20308 | 18 | temp_zinit.last_map=0; | |
| 20309 | 18 | temp_zinit.last_screen=0; | |
| 20310 | 18 | } | |
| 20311 | |||
| 20312 |
5/6✓ Branch 0 taken 270 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 265 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
|
288 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<68))) |
| 20313 | { | ||
| 20314 | 18 | temp_zinit.mcounter[crMAGIC]=0; | |
| 20315 | 18 | temp_zinit.counter[crMAGIC]=0; | |
| 20316 | 18 | temp_zinit.magicdrainrate = 2; | |
| 20317 | 18 | } | |
| 20318 | |||
| 20319 |
5/6✓ Branch 0 taken 270 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 265 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
|
288 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<129))) |
| 20320 | { | ||
| 20321 | |||
| 20322 |
2/2✓ Branch 0 taken 72 times.
✓ Branch 1 taken 18 times.
|
90 | for(int32_t x=0; x<4; x++) |
| 20323 | { | ||
| 20324 | 72 | beam_hearts[x]=100; | |
| 20325 | 72 | } | |
| 20326 | |||
| 20327 |
2/2✓ Branch 0 taken 72 times.
✓ Branch 1 taken 18 times.
|
90 | for(int32_t i=0; i<idBP_MAX; i++) |
| 20328 | { | ||
| 20329 | 72 | set_bit(&beam_percent,i,!get_qr(qr_LENSHINTS+i)); | |
| 20330 | 72 | set_qr(qr_LENSHINTS+i,0); | |
| 20331 | 72 | } | |
| 20332 | |||
| 20333 |
2/2✓ Branch 0 taken 72 times.
✓ Branch 1 taken 18 times.
|
90 | for(int32_t x=0; x<4; x++) |
| 20334 | { | ||
| 20335 | 72 | beam_power[x]=get_qr(qr_HIDECARRIEDITEMS)?50:100; | |
| 20336 | 72 | } | |
| 20337 | |||
| 20338 | 18 | set_qr(qr_HIDECARRIEDITEMS,0); | |
| 20339 | 18 | hookshot_links=100; | |
| 20340 | 18 | temp_zinit.msg_more_x=224; | |
| 20341 | 18 | temp_zinit.msg_more_y=64; | |
| 20342 | 18 | } | |
| 20343 | |||
| 20344 | // Okay, let's put these legacy values into itemsbuf. | ||
| 20345 |
2/2✓ Branch 0 taken 206 times.
✓ Branch 1 taken 82 times.
|
288 | if(s_version < 15) |
| 20346 |
2/2✓ Branch 0 taken 20992 times.
✓ Branch 1 taken 82 times.
|
21074 | for(int32_t i=0; i<MAXITEMS; i++) |
| 20347 | { | ||
| 20348 |
11/11✓ Branch 0 taken 82 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 82 times.
✓ Branch 3 taken 82 times.
✓ Branch 4 taken 82 times.
✓ Branch 5 taken 82 times.
✓ Branch 6 taken 82 times.
✓ Branch 7 taken 82 times.
✓ Branch 8 taken 20172 times.
✓ Branch 9 taken 82 times.
✓ Branch 10 taken 82 times.
|
20992 | switch(i) |
| 20349 | { | ||
| 20350 | case iFairyStill: | ||
| 20351 | 82 | itemsbuf[i].misc1 = stationary_fairy_hearts; | |
| 20352 | 82 | itemsbuf[i].misc2 = stationary_fairy_magic; | |
| 20353 | 82 | itemsbuf[i].misc3 = 0; | |
| 20354 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | if (stationary_fairy_heart_percent) itemsbuf[i].flags |= item_flag1; |
| 20355 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | if (stationary_fairy_magic_percent) itemsbuf[i].flags |= item_flag2; |
| 20356 | 82 | break; | |
| 20357 | |||
| 20358 | case iFairyMoving: | ||
| 20359 | 82 | itemsbuf[i].misc1 = moving_fairy_hearts; | |
| 20360 | 82 | itemsbuf[i].misc2 = moving_fairy_magic; | |
| 20361 | 82 | itemsbuf[i].misc3 = 50; | |
| 20362 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | if (moving_fairy_heart_percent) itemsbuf[i].flags |= item_flag1; |
| 20363 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | if (moving_fairy_magic_percent) itemsbuf[i].flags |= item_flag2; |
| 20364 | 82 | break; | |
| 20365 | |||
| 20366 | case iRPotion: | ||
| 20367 | 82 | itemsbuf[i].misc1 = red_potion_hearts; | |
| 20368 | 82 | itemsbuf[i].misc2 = red_potion_magic; | |
| 20369 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 82 times.
|
82 | if (red_potion_heart_percent) itemsbuf[i].flags |= item_flag1; |
| 20370 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 82 times.
|
82 | if (red_potion_magic_percent) itemsbuf[i].flags |= item_flag2; |
| 20371 | 82 | break; | |
| 20372 | |||
| 20373 | case iBPotion: | ||
| 20374 | 82 | itemsbuf[i].misc1 = blue_potion_hearts; | |
| 20375 | 82 | itemsbuf[i].misc2 = blue_potion_magic; | |
| 20376 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 82 times.
|
82 | if (blue_potion_heart_percent) itemsbuf[i].flags |= item_flag1; |
| 20377 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 82 times.
|
82 | if (blue_potion_magic_percent) itemsbuf[i].flags |= item_flag2; |
| 20378 | 82 | break; | |
| 20379 | |||
| 20380 | case iSword: | ||
| 20381 | 82 | itemsbuf[i].pickup_hearts = sword_hearts[0]; | |
| 20382 | 82 | itemsbuf[i].misc1 = beam_hearts[0]; | |
| 20383 | 82 | itemsbuf[i].misc2 = beam_power[0]; | |
| 20384 | // It seems that item_flag1 was already added by reset_itembuf()... | ||
| 20385 | 82 | itemsbuf[i].flags &= (!get_bit(&beam_percent,0)) ? ~item_flag1 : ~item_none; | |
| 20386 | 82 | break; | |
| 20387 | |||
| 20388 | case iWSword: | ||
| 20389 | 82 | itemsbuf[i].pickup_hearts = sword_hearts[1]; | |
| 20390 | 82 | itemsbuf[i].misc1 = beam_hearts[1]; | |
| 20391 | 82 | itemsbuf[i].misc2 = beam_power[1]; | |
| 20392 | 82 | itemsbuf[i].flags &= (!get_bit(&beam_percent,1)) ? ~item_flag1 : ~item_none; | |
| 20393 | 82 | break; | |
| 20394 | |||
| 20395 | case iMSword: | ||
| 20396 | 82 | itemsbuf[i].pickup_hearts = sword_hearts[2]; | |
| 20397 | 82 | itemsbuf[i].misc1 = beam_hearts[2]; | |
| 20398 | 82 | itemsbuf[i].misc2 = beam_power[2]; | |
| 20399 | 82 | itemsbuf[i].flags &= (!get_bit(&beam_percent,2)) ? ~item_flag1 : ~item_none; | |
| 20400 | 82 | break; | |
| 20401 | |||
| 20402 | case iXSword: | ||
| 20403 | 82 | itemsbuf[i].pickup_hearts = sword_hearts[3]; | |
| 20404 | 82 | itemsbuf[i].misc1 = beam_hearts[3]; | |
| 20405 | 82 | itemsbuf[i].misc2 = beam_power[3]; | |
| 20406 | 82 | itemsbuf[i].flags &= (!get_bit(&beam_percent,3)) ? ~item_flag1 : ~item_none; | |
| 20407 | 82 | break; | |
| 20408 | |||
| 20409 | case iHookshot: | ||
| 20410 | 82 | itemsbuf[i].misc1 = hookshot_length; | |
| 20411 | 82 | itemsbuf[i].misc2 = hookshot_links; | |
| 20412 | 82 | break; | |
| 20413 | |||
| 20414 | case iLongshot: | ||
| 20415 | 82 | itemsbuf[i].misc1 = longshot_length; | |
| 20416 | 82 | itemsbuf[i].misc2 = longshot_links; | |
| 20417 | 82 | break; | |
| 20418 | } | ||
| 20419 | 21074 | } | |
| 20420 | |||
| 20421 |
6/6✓ Branch 0 taken 270 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 265 times.
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 1 times.
|
288 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<168))) |
| 20422 | { | ||
| 20423 | //was new subscreen rule | ||
| 20424 | 22 | subscr_mode=get_qr(qr_FREEFORM)?1:0; | |
| 20425 | 22 | set_qr(qr_FREEFORM,0); | |
| 20426 | 22 | } | |
| 20427 | |||
| 20428 |
5/6✓ Branch 0 taken 270 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 265 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
288 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<185))) |
| 20429 | { | ||
| 20430 | 23 | temp_zinit.start_dmap=0; | |
| 20431 | 23 | } | |
| 20432 | |||
| 20433 |
5/6✓ Branch 0 taken 270 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 265 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
288 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<186))) |
| 20434 | { | ||
| 20435 | 23 | temp_zinit.heroAnimationStyle=get_qr(qr_BSZELDA)?1:0; | |
| 20436 | 23 | } | |
| 20437 | |||
| 20438 |
3/4✓ Branch 0 taken 82 times.
✓ Branch 1 taken 206 times.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
288 | if(s_version < 16 && get_bit(deprecated_rules, qr_COOLSCROLL+1)) |
| 20439 | { | ||
| 20440 | //addOldStyleFamily(&temp_zinit, itemsbuf, itype_wallet, 4); //is this needed? | ||
| 20441 | ✗ | temp_zinit.mcounter[crMONEY]=999; | |
| 20442 | //temp_zinit.counter[crMONEY]=999; //This rule only gave you an invisible max wallet; it did not give you max rupies. | ||
| 20443 | ✗ | } | |
| 20444 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 6 times.
|
288 | if(Header->zelda_version < 0x190) //1.84 bugfix. -Z |
| 20445 | { | ||
| 20446 | //temp_zinit.items[iBombBag] = true; //No, this is 30 max bombs! | ||
| 20447 | 6 | temp_zinit.mcounter[crBOMBS] = 8; | |
| 20448 | 6 | } | |
| 20449 | // al_trace("About to copy over new init data values for quest made in: %x\n", Header->zelda_version); | ||
| 20450 | //time to ensure that we port all new values properly: | ||
| 20451 |
2/2✓ Branch 0 taken 206 times.
✓ Branch 1 taken 82 times.
|
288 | if(Header->zelda_version < 0x250) |
| 20452 | { | ||
| 20453 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | temp_zinit.mcounter[crSBOMBS] = bomb_ratio > 0 ? ( temp_zinit.mcounter[crBOMBS]/temp_zinit.bomb_ratio ) : (temp_zinit.mcounter[crBOMBS]/4); |
| 20454 | 82 | } | |
| 20455 | |||
| 20456 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 271 times.
|
288 | if(s_version > 21) |
| 20457 | { | ||
| 20458 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_getc(&temp_zinit.hp_per_heart,f)) |
| 20459 | { | ||
| 20460 | ✗ | return qe_invalid; | |
| 20461 | } | ||
| 20462 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_getc(&temp_zinit.magic_per_block,f)) |
| 20463 | { | ||
| 20464 | ✗ | return qe_invalid; | |
| 20465 | } | ||
| 20466 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_getc(&temp_zinit.hero_damage_multiplier,f)) |
| 20467 | { | ||
| 20468 | ✗ | return qe_invalid; | |
| 20469 | } | ||
| 20470 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_getc(&temp_zinit.ene_damage_multiplier,f)) |
| 20471 | { | ||
| 20472 | ✗ | return qe_invalid; | |
| 20473 | } | ||
| 20474 | 17 | } | |
| 20475 | else | ||
| 20476 | { | ||
| 20477 | 271 | temp_zinit.hp_per_heart = 16; //HP_PER_HEART, previously hardcoded | |
| 20478 | 271 | temp_zinit.magic_per_block = 32; //MAGICPERBLOCK, previously hardcoded | |
| 20479 | 271 | temp_zinit.hero_damage_multiplier = 2; //DAMAGE_MULTIPLIER, previously hardcoded | |
| 20480 | 271 | temp_zinit.ene_damage_multiplier = 4; //(HP_PER_HEART/4), previously hardcoded | |
| 20481 | } | ||
| 20482 | |||
| 20483 |
2/2✓ Branch 0 taken 271 times.
✓ Branch 1 taken 17 times.
|
288 | if(s_version > 22) |
| 20484 | { | ||
| 20485 |
2/2✓ Branch 0 taken 425 times.
✓ Branch 1 taken 17 times.
|
442 | for(int32_t q = crCUSTOM1; q <= crCUSTOM25; ++q) |
| 20486 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 425 times.
|
425 | if(!p_igetw(&temp_zinit.counter[q],f)) |
| 20487 | ✗ | return qe_invalid; | |
| 20488 |
2/2✓ Branch 0 taken 425 times.
✓ Branch 1 taken 17 times.
|
442 | for(int32_t q = crCUSTOM1; q <= crCUSTOM25; ++q) |
| 20489 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 425 times.
|
425 | if(!p_igetw(&temp_zinit.mcounter[q],f)) |
| 20490 | ✗ | return qe_invalid; | |
| 20491 | 17 | } | |
| 20492 | |||
| 20493 | |||
| 20494 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 271 times.
|
288 | if(s_version > 23) |
| 20495 | { | ||
| 20496 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_getc(&temp_zinit.dither_type,f)) |
| 20497 | { | ||
| 20498 | ✗ | return qe_invalid; | |
| 20499 | } | ||
| 20500 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_getc(&temp_zinit.dither_arg,f)) |
| 20501 | { | ||
| 20502 | ✗ | return qe_invalid; | |
| 20503 | } | ||
| 20504 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_getc(&temp_zinit.dither_percent,f)) |
| 20505 | { | ||
| 20506 | ✗ | return qe_invalid; | |
| 20507 | } | ||
| 20508 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_getc(&temp_zinit.def_lightrad,f)) |
| 20509 | { | ||
| 20510 | ✗ | return qe_invalid; | |
| 20511 | } | ||
| 20512 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_getc(&temp_zinit.transdark_percent,f)) |
| 20513 | { | ||
| 20514 | ✗ | return qe_invalid; | |
| 20515 | } | ||
| 20516 | 17 | } | |
| 20517 | else | ||
| 20518 | { | ||
| 20519 | 271 | temp_zinit.dither_type = 0; | |
| 20520 | 271 | temp_zinit.dither_arg = 0; | |
| 20521 | 271 | temp_zinit.dither_percent = 20; | |
| 20522 | 271 | temp_zinit.def_lightrad = 24; | |
| 20523 | 271 | temp_zinit.transdark_percent = 0; | |
| 20524 | } | ||
| 20525 | |||
| 20526 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 271 times.
|
288 | if(s_version > 24) |
| 20527 | { | ||
| 20528 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_getc(&temp_zinit.darkcol,f)) |
| 20529 | { | ||
| 20530 | ✗ | return qe_invalid; | |
| 20531 | } | ||
| 20532 | 17 | } | |
| 20533 | else | ||
| 20534 | { | ||
| 20535 | 271 | temp_zinit.darkcol = BLACK; | |
| 20536 | } | ||
| 20537 | |||
| 20538 |
2/2✓ Branch 0 taken 271 times.
✓ Branch 1 taken 17 times.
|
288 | if(s_version > 25) |
| 20539 | { | ||
| 20540 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetl(&temp_zinit.gravity,f)) |
| 20541 | { | ||
| 20542 | ✗ | return qe_invalid; | |
| 20543 | } | ||
| 20544 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetl(&temp_zinit.swimgravity,f)) |
| 20545 | { | ||
| 20546 | ✗ | return qe_invalid; | |
| 20547 | } | ||
| 20548 | 17 | } | |
| 20549 | |||
| 20550 | |||
| 20551 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 271 times.
|
288 | if(s_version > 26) |
| 20552 | { | ||
| 20553 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetw(&temp_zinit.heroSideswimUpStep,f)) |
| 20554 | { | ||
| 20555 | ✗ | return qe_invalid; | |
| 20556 | } | ||
| 20557 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetw(&temp_zinit.heroSideswimSideStep,f)) |
| 20558 | { | ||
| 20559 | ✗ | return qe_invalid; | |
| 20560 | } | ||
| 20561 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetw(&temp_zinit.heroSideswimDownStep,f)) |
| 20562 | { | ||
| 20563 | ✗ | return qe_invalid; | |
| 20564 | } | ||
| 20565 | 17 | } | |
| 20566 | else | ||
| 20567 | { | ||
| 20568 | 271 | temp_zinit.heroSideswimUpStep = 150; | |
| 20569 | 271 | temp_zinit.heroSideswimSideStep = 100; | |
| 20570 | 271 | temp_zinit.heroSideswimDownStep = 75; | |
| 20571 | } | ||
| 20572 | |||
| 20573 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 271 times.
|
288 | if(s_version > 27) |
| 20574 | { | ||
| 20575 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetl(&temp_zinit.exitWaterJump,f)) |
| 20576 | { | ||
| 20577 | ✗ | return qe_invalid; | |
| 20578 | } | ||
| 20579 | 17 | } | |
| 20580 | else | ||
| 20581 | { | ||
| 20582 | 271 | temp_zinit.exitWaterJump = 0; | |
| 20583 | } | ||
| 20584 | |||
| 20585 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 271 times.
|
288 | if(s_version > 29) |
| 20586 | { | ||
| 20587 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_igetl(&temp_zinit.bunny_ltm,f)) |
| 20588 | { | ||
| 20589 | ✗ | return qe_invalid; | |
| 20590 | } | ||
| 20591 | 17 | } | |
| 20592 | else | ||
| 20593 | { | ||
| 20594 | 271 | temp_zinit.bunny_ltm = 0; | |
| 20595 | } | ||
| 20596 | |||
| 20597 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 271 times.
|
288 | if(s_version > 30) |
| 20598 | { | ||
| 20599 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_getc(&temp_zinit.switchhookstyle,f)) |
| 20600 | { | ||
| 20601 | ✗ | return qe_invalid; | |
| 20602 | } | ||
| 20603 | 17 | } | |
| 20604 | else | ||
| 20605 | { | ||
| 20606 | 271 | temp_zinit.switchhookstyle = 1; | |
| 20607 | } | ||
| 20608 | |||
| 20609 |
2/2✓ Branch 0 taken 271 times.
✓ Branch 1 taken 17 times.
|
288 | if(s_version > 31) |
| 20610 | { | ||
| 20611 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(!p_getc(&temp_zinit.magicdrainrate,f)) |
| 20612 | { | ||
| 20613 | ✗ | return qe_invalid; | |
| 20614 | } | ||
| 20615 | 17 | } | |
| 20616 | |||
| 20617 | 288 | temp_zinit.clear_genscript(); | |
| 20618 |
2/2✓ Branch 0 taken 276 times.
✓ Branch 1 taken 12 times.
|
288 | if(s_version > 32) |
| 20619 | { | ||
| 20620 | 12 | word numgenscript = 0; | |
| 20621 |
1/2✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
|
12 | if(!p_igetw(&numgenscript,f)) |
| 20622 | ✗ | return qe_invalid; | |
| 20623 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
12 | if (numgenscript > NUMSCRIPTSGENERIC) |
| 20624 | ✗ | return qe_invalid; | |
| 20625 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
12 | for(auto q = 1; q < numgenscript; ++q) |
| 20626 | { | ||
| 20627 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 20628 | ✗ | return qe_invalid; | |
| 20629 | ✗ | if(!(tempbyte&2)) | |
| 20630 | ✗ | continue; | |
| 20631 | ✗ | temp_zinit.gen_doscript.set(q, tempbyte&1); | |
| 20632 | ✗ | if(!p_igetw(&temp_zinit.gen_exitState[q],f)) | |
| 20633 | ✗ | return qe_invalid; | |
| 20634 | ✗ | if(!p_igetw(&temp_zinit.gen_reloadState[q],f)) | |
| 20635 | ✗ | return qe_invalid; | |
| 20636 | ✗ | for(auto p = 0; p < 8; ++p) | |
| 20637 | ✗ | if(!p_igetl(&temp_zinit.gen_initd[q][p],f)) | |
| 20638 | ✗ | return qe_invalid; | |
| 20639 | dword sz; | ||
| 20640 | ✗ | if(!p_igetl(&sz,f)) | |
| 20641 | ✗ | return qe_invalid; | |
| 20642 | ✗ | temp_zinit.gen_data[q].resize(sz); | |
| 20643 | ✗ | std::vector<int32_t> dummy; | |
| 20644 | ✗ | if(!p_getlvec(&dummy,f)) | |
| 20645 | ✗ | return qe_invalid; | |
| 20646 | ✗ | temp_zinit.gen_data[q] = dummy; | |
| 20647 | ✗ | if(!p_igetl(&temp_zinit.gen_eventstate[q],f)) | |
| 20648 | ✗ | return qe_invalid; | |
| 20649 | ✗ | } | |
| 20650 | 12 | } | |
| 20651 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 6 times.
|
288 | if(s_version > 33) |
| 20652 | { | ||
| 20653 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | if(!p_getc(&temp_zinit.hero_swim_mult,f)) |
| 20654 | ✗ | return qe_invalid; | |
| 20655 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | if(!p_getc(&temp_zinit.hero_swim_div,f)) |
| 20656 | ✗ | return qe_invalid; | |
| 20657 | 6 | } | |
| 20658 |
1/2✓ Branch 0 taken 288 times.
✗ Branch 1 not taken.
|
288 | if(s_version > 34) |
| 20659 | { | ||
| 20660 | uint32_t num_used_mapscr_data; | ||
| 20661 | ✗ | if(!p_igetl(&num_used_mapscr_data,f)) | |
| 20662 | ✗ | return qe_invalid; | |
| 20663 | ✗ | for(uint32_t q = 0; q < num_used_mapscr_data; ++q) | |
| 20664 | { | ||
| 20665 | uint32_t sz; | ||
| 20666 | ✗ | if(!p_igetl(&sz,f)) | |
| 20667 | ✗ | return qe_invalid; | |
| 20668 | ✗ | temp_zinit.screen_data[q].resize(sz); | |
| 20669 | ✗ | if(sz) | |
| 20670 | { | ||
| 20671 | ✗ | std::vector<int32_t> dummy; | |
| 20672 | ✗ | if(!p_getlvec(&dummy,f)) | |
| 20673 | ✗ | return qe_invalid; | |
| 20674 | ✗ | temp_zinit.screen_data[q] = dummy; | |
| 20675 | ✗ | } | |
| 20676 | ✗ | } | |
| 20677 | ✗ | } | |
| 20678 |
1/2✓ Branch 0 taken 288 times.
✗ Branch 1 not taken.
|
288 | if (s_version > 35) |
| 20679 | ✗ | if(!p_igetzf(&temp_zinit.shove_offset,f)) | |
| 20680 | ✗ | return qe_invalid; | |
| 20681 | |||
| 20682 | 288 | temp_zinit.counter[crLIFE] *= temp_zinit.hp_per_heart; | |
| 20683 | 288 | temp_zinit.mcounter[crLIFE] *= temp_zinit.hp_per_heart; | |
| 20684 |
2/2✓ Branch 0 taken 187 times.
✓ Branch 1 taken 101 times.
|
288 | if(!temp_zinit.flags.get(INIT_FL_CONTPERCENT)) |
| 20685 | 101 | temp_zinit.cont_heart *= temp_zinit.hp_per_heart; | |
| 20686 | |||
| 20687 | 288 | return 0; | |
| 20688 | 288 | } | |
| 20689 | 414 | int32_t readinitdata(PACKFILE *f, zquestheader *Header) | |
| 20690 | { | ||
| 20691 | 414 | zinitdata temp_zinit = {}; | |
| 20692 | |||
| 20693 |
3/4✓ Branch 0 taken 391 times.
✓ Branch 1 taken 23 times.
✓ Branch 2 taken 23 times.
✗ Branch 3 not taken.
|
414 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_initdata); |
| 20694 | |||
| 20695 | int32_t dummy; | ||
| 20696 | 414 | word s_version=0, s_cversion=0; | |
| 20697 | byte padding; | ||
| 20698 | |||
| 20699 |
2/2✓ Branch 0 taken 391 times.
✓ Branch 1 taken 23 times.
|
414 | if(Header->zelda_version > 0x192) |
| 20700 | { | ||
| 20701 |
2/4✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 391 times.
✗ Branch 3 not taken.
|
391 | if(!p_igetw(&s_version,f)) |
| 20702 | ✗ | return qe_invalid; | |
| 20703 | 391 | FFCore.quest_format[vInitData] = s_version; | |
| 20704 | |||
| 20705 |
2/4✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 391 times.
✗ Branch 3 not taken.
|
391 | if(!p_igetw(&s_cversion,f)) |
| 20706 | ✗ | return qe_invalid; | |
| 20707 | |||
| 20708 | //section size | ||
| 20709 |
2/4✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 391 times.
✗ Branch 3 not taken.
|
391 | if(!p_igetl(&dummy,f)) |
| 20710 | ✗ | return qe_invalid; | |
| 20711 | 391 | } | |
| 20712 | |||
| 20713 |
2/2✓ Branch 0 taken 288 times.
✓ Branch 1 taken 126 times.
|
414 | if(s_version < 37) |
| 20714 | { | ||
| 20715 |
2/4✓ Branch 0 taken 288 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 288 times.
|
288 | if(auto ret = readinitdata_old(f,Header,s_version,s_cversion,temp_zinit)) |
| 20716 | ✗ | return ret; | |
| 20717 | 288 | } | |
| 20718 | else | ||
| 20719 | { | ||
| 20720 | 126 | subscr_mode = ssdtMAX; | |
| 20721 |
2/2✓ Branch 0 taken 4032 times.
✓ Branch 1 taken 126 times.
|
4158 | for(int q = 0; q < MAXITEMS/8; ++q) |
| 20722 |
2/4✓ Branch 0 taken 4032 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4032 times.
|
4032 | if(!p_getc(&temp_zinit.items[q], f)) |
| 20723 | ✗ | return qe_invalid; | |
| 20724 |
2/2✓ Branch 0 taken 126 times.
✓ Branch 1 taken 8064 times.
|
8190 | for(int q = 0; q < MAXLEVELS/8; ++q) |
| 20725 | { | ||
| 20726 |
2/4✓ Branch 0 taken 8064 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8064 times.
✗ Branch 3 not taken.
|
8064 | if(!p_getc(&temp_zinit.map[q], f)) |
| 20727 | ✗ | return qe_invalid; | |
| 20728 |
2/4✓ Branch 0 taken 8064 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 8064 times.
|
8064 | if(!p_getc(&temp_zinit.compass[q], f)) |
| 20729 | ✗ | return qe_invalid; | |
| 20730 |
2/4✓ Branch 0 taken 8064 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 8064 times.
|
8064 | if(!p_getc(&temp_zinit.boss_key[q], f)) |
| 20731 | ✗ | return qe_invalid; | |
| 20732 |
2/4✓ Branch 0 taken 8064 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8064 times.
✗ Branch 3 not taken.
|
8064 | if(!p_getc(&temp_zinit.mcguffin[q], f)) |
| 20733 | ✗ | return qe_invalid; | |
| 20734 | 8064 | } | |
| 20735 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getbvec(&temp_zinit.level_keys, f)) |
| 20736 | ✗ | return qe_invalid; | |
| 20737 | byte num_counters; | ||
| 20738 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getc(&num_counters,f)) |
| 20739 | ✗ | return qe_invalid; | |
| 20740 |
2/2✓ Branch 0 taken 13482 times.
✓ Branch 1 taken 126 times.
|
13608 | for(int q = 0; q < num_counters; ++q) |
| 20741 |
2/4✓ Branch 0 taken 13482 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 13482 times.
|
13482 | if(!p_igetw(&temp_zinit.counter[q],f)) |
| 20742 | ✗ | return qe_invalid; | |
| 20743 |
2/2✓ Branch 0 taken 126 times.
✓ Branch 1 taken 13482 times.
|
13608 | for(int q = 0; q < num_counters; ++q) |
| 20744 |
2/4✓ Branch 0 taken 13482 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 13482 times.
|
13482 | if(!p_igetw(&temp_zinit.mcounter[q],f)) |
| 20745 | ✗ | return qe_invalid; | |
| 20746 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getc(&temp_zinit.bomb_ratio,f)) |
| 20747 | ✗ | return qe_invalid; | |
| 20748 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getc(&temp_zinit.hcp,f)) |
| 20749 | ✗ | return qe_invalid; | |
| 20750 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getc(&temp_zinit.hcp_per_hc,f)) |
| 20751 | ✗ | return qe_invalid; | |
| 20752 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_igetw(&temp_zinit.cont_heart,f)) |
| 20753 | ✗ | return qe_invalid; | |
| 20754 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getc(&temp_zinit.hp_per_heart,f)) |
| 20755 | ✗ | return qe_invalid; | |
| 20756 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getc(&temp_zinit.magic_per_block,f)) |
| 20757 | ✗ | return qe_invalid; | |
| 20758 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getc(&temp_zinit.hero_damage_multiplier,f)) |
| 20759 | ✗ | return qe_invalid; | |
| 20760 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getc(&temp_zinit.ene_damage_multiplier,f)) |
| 20761 | ✗ | return qe_invalid; | |
| 20762 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getc(&temp_zinit.dither_type,f)) |
| 20763 | ✗ | return qe_invalid; | |
| 20764 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getc(&temp_zinit.dither_arg,f)) |
| 20765 | ✗ | return qe_invalid; | |
| 20766 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getc(&temp_zinit.dither_percent,f)) |
| 20767 | ✗ | return qe_invalid; | |
| 20768 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getc(&temp_zinit.def_lightrad,f)) |
| 20769 | ✗ | return qe_invalid; | |
| 20770 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getc(&temp_zinit.transdark_percent,f)) |
| 20771 | ✗ | return qe_invalid; | |
| 20772 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getc(&temp_zinit.darkcol,f)) |
| 20773 | ✗ | return qe_invalid; | |
| 20774 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_igetl(&temp_zinit.ss_grid_x,f)) |
| 20775 | ✗ | return qe_invalid; | |
| 20776 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_igetl(&temp_zinit.ss_grid_y,f)) |
| 20777 | ✗ | return qe_invalid; | |
| 20778 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_igetl(&temp_zinit.ss_grid_xofs,f)) |
| 20779 | ✗ | return qe_invalid; | |
| 20780 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_igetl(&temp_zinit.ss_grid_yofs,f)) |
| 20781 | ✗ | return qe_invalid; | |
| 20782 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_igetl(&temp_zinit.ss_grid_color,f)) |
| 20783 | ✗ | return qe_invalid; | |
| 20784 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_igetl(&temp_zinit.ss_bbox_1_color,f)) |
| 20785 | ✗ | return qe_invalid; | |
| 20786 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_igetl(&temp_zinit.ss_bbox_2_color,f)) |
| 20787 | ✗ | return qe_invalid; | |
| 20788 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_igetl(&temp_zinit.ss_flags,f)) |
| 20789 | ✗ | return qe_invalid; | |
| 20790 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getbitstr(&temp_zinit.flags,f)) |
| 20791 | ✗ | return qe_invalid; | |
| 20792 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getc(&temp_zinit.last_map,f)) |
| 20793 | ✗ | return qe_invalid; | |
| 20794 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getc(&temp_zinit.last_screen,f)) |
| 20795 | ✗ | return qe_invalid; | |
| 20796 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getc(&temp_zinit.msg_more_x,f)) |
| 20797 | ✗ | return qe_invalid; | |
| 20798 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getc(&temp_zinit.msg_more_y,f)) |
| 20799 | ✗ | return qe_invalid; | |
| 20800 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getc(&temp_zinit.msg_more_is_offset,f)) |
| 20801 | ✗ | return qe_invalid; | |
| 20802 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getc(&temp_zinit.msg_speed,f)) |
| 20803 | ✗ | return qe_invalid; | |
| 20804 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_igetl(&temp_zinit.gravity,f)) |
| 20805 | ✗ | return qe_invalid; | |
| 20806 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_igetl(&temp_zinit.swimgravity,f)) |
| 20807 | ✗ | return qe_invalid; | |
| 20808 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_igetw(&temp_zinit.terminalv,f)) |
| 20809 | ✗ | return qe_invalid; | |
| 20810 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getc(&temp_zinit.hero_swim_speed,f)) |
| 20811 | ✗ | return qe_invalid; | |
| 20812 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getc(&temp_zinit.hero_swim_mult,f)) |
| 20813 | ✗ | return qe_invalid; | |
| 20814 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getc(&temp_zinit.hero_swim_div,f)) |
| 20815 | ✗ | return qe_invalid; | |
| 20816 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_igetw(&temp_zinit.heroSideswimUpStep,f)) |
| 20817 | ✗ | return qe_invalid; | |
| 20818 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_igetw(&temp_zinit.heroSideswimSideStep,f)) |
| 20819 | ✗ | return qe_invalid; | |
| 20820 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_igetw(&temp_zinit.heroSideswimDownStep,f)) |
| 20821 | ✗ | return qe_invalid; | |
| 20822 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_igetl(&temp_zinit.exitWaterJump,f)) |
| 20823 | ✗ | return qe_invalid; | |
| 20824 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_igetw(&temp_zinit.heroStep,f)) |
| 20825 | ✗ | return qe_invalid; | |
| 20826 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getc(&temp_zinit.heroAnimationStyle,f)) |
| 20827 | ✗ | return qe_invalid; | |
| 20828 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getc(&temp_zinit.jump_hero_layer_threshold,f)) |
| 20829 | ✗ | return qe_invalid; | |
| 20830 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_igetl(&temp_zinit.bunny_ltm,f)) |
| 20831 | ✗ | return qe_invalid; | |
| 20832 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_igetw(&temp_zinit.start_dmap,f)) |
| 20833 | ✗ | return qe_invalid; | |
| 20834 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_igetw(&temp_zinit.subscrSpeed,f)) |
| 20835 | ✗ | return qe_invalid; | |
| 20836 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getc(&temp_zinit.switchhookstyle,f)) |
| 20837 | ✗ | return qe_invalid; | |
| 20838 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getc(&temp_zinit.magicdrainrate,f)) |
| 20839 | ✗ | return qe_invalid; | |
| 20840 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_igetzf(&temp_zinit.shove_offset,f)) |
| 20841 | ✗ | return qe_invalid; | |
| 20842 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getbitstr(&temp_zinit.gen_doscript, f)) |
| 20843 | ✗ | return qe_invalid; | |
| 20844 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getbmap(&temp_zinit.gen_exitState, f)) |
| 20845 | ✗ | return qe_invalid; | |
| 20846 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getbmap(&temp_zinit.gen_reloadState, f)) |
| 20847 | ✗ | return qe_invalid; | |
| 20848 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getbmap(&temp_zinit.gen_initd, f)) |
| 20849 | ✗ | return qe_invalid; | |
| 20850 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getbmap(&temp_zinit.gen_eventstate, f)) |
| 20851 | ✗ | return qe_invalid; | |
| 20852 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getbmap(&temp_zinit.gen_data, f)) |
| 20853 | ✗ | return qe_invalid; | |
| 20854 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if(!p_getbmap(&temp_zinit.screen_data, f)) |
| 20855 | ✗ | return qe_invalid; | |
| 20856 |
1/2✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
|
126 | if (s_version >= 38) |
| 20857 | { | ||
| 20858 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if (!p_getc(&temp_zinit.spriteflickerspeed, f)) |
| 20859 | ✗ | return qe_invalid; | |
| 20860 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if (!p_getc(&temp_zinit.spriteflickercolor, f)) |
| 20861 | ✗ | return qe_invalid; | |
| 20862 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if (!p_getc(&temp_zinit.spriteflickertransp, f)) |
| 20863 | ✗ | return qe_invalid; | |
| 20864 | 126 | } | |
| 20865 |
2/2✓ Branch 0 taken 102 times.
✓ Branch 1 taken 24 times.
|
126 | if(s_version >= 39) |
| 20866 |
2/4✓ Branch 0 taken 102 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 102 times.
✗ Branch 3 not taken.
|
102 | if(!p_igetzf(&temp_zinit.air_drag, f)) |
| 20867 | ✗ | return qe_invalid; | |
| 20868 | } | ||
| 20869 |
1/2✓ Branch 0 taken 414 times.
✗ Branch 1 not taken.
|
414 | if (should_skip) |
| 20870 | ✗ | return 0; | |
| 20871 | |||
| 20872 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 414 times.
|
414 | if(loading_tileset_flags & TILESET_CLEARMAPS) |
| 20873 | { | ||
| 20874 | ✗ | temp_zinit.last_map = 0; | |
| 20875 | ✗ | temp_zinit.last_screen = 0; | |
| 20876 | ✗ | temp_zinit.screen_data.clear(); | |
| 20877 | ✗ | } | |
| 20878 |
1/2✓ Branch 0 taken 414 times.
✗ Branch 1 not taken.
|
414 | temp_zinit.normalize(); |
| 20879 |
1/2✓ Branch 0 taken 414 times.
✗ Branch 1 not taken.
|
414 | zinit = temp_zinit; |
| 20880 | |||
| 20881 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 414 times.
|
414 | if(zinit.heroAnimationStyle==las_zelda3slow) |
| 20882 | { | ||
| 20883 | ✗ | hero_animation_speed=2; | |
| 20884 | ✗ | } | |
| 20885 | else | ||
| 20886 | { | ||
| 20887 | 414 | hero_animation_speed=1; | |
| 20888 | } | ||
| 20889 | |||
| 20890 | 414 | return 0; | |
| 20891 | 414 | } | |
| 20892 | |||
| 20893 | /* | ||
| 20894 | void setupitemdropsets() | ||
| 20895 | { | ||
| 20896 | for(int32_t i=0; i<isMAX; i++) | ||
| 20897 | { | ||
| 20898 | memcpy(&item_drop_sets[i], &default_item_drop_sets[i], sizeof(item_drop_object)); | ||
| 20899 | } | ||
| 20900 | } | ||
| 20901 | */ | ||
| 20902 | |||
| 20903 | 355 | int32_t readitemdropsets(PACKFILE *f, int32_t version, word build) | |
| 20904 | { | ||
| 20905 |
2/2✓ Branch 0 taken 332 times.
✓ Branch 1 taken 23 times.
|
355 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_itemdropsets); |
| 20906 | |||
| 20907 | 355 | build=build; // here to prevent compiler warnings | |
| 20908 | dword dummy_dword; | ||
| 20909 | 355 | word item_drop_sets_to_read=0; | |
| 20910 | item_drop_object tempitemdrop; | ||
| 20911 | 355 | word s_version=0, s_cversion=0; | |
| 20912 | |||
| 20913 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 355 times.
|
355 | if (!should_skip) |
| 20914 |
2/2✓ Branch 0 taken 90880 times.
✓ Branch 1 taken 355 times.
|
91235 | for(int32_t i=0; i<MAXITEMDROPSETS; i++) |
| 20915 | { | ||
| 20916 | 90880 | memset(&item_drop_sets[i], 0, sizeof(item_drop_object)); | |
| 20917 | 91235 | } | |
| 20918 | |||
| 20919 |
2/2✓ Branch 0 taken 332 times.
✓ Branch 1 taken 23 times.
|
355 | if(version > 0x192) |
| 20920 | { | ||
| 20921 | 332 | item_drop_sets_to_read=0; | |
| 20922 | |||
| 20923 | //section version info | ||
| 20924 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_igetw(&s_version,f)) |
| 20925 | { | ||
| 20926 | ✗ | return qe_invalid; | |
| 20927 | } | ||
| 20928 | |||
| 20929 | 332 | FFCore.quest_format[vItemDropsets] = s_version; | |
| 20930 | |||
| 20931 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_igetw(&s_cversion,f)) |
| 20932 | { | ||
| 20933 | ✗ | return qe_invalid; | |
| 20934 | } | ||
| 20935 | |||
| 20936 | //section size | ||
| 20937 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_igetl(&dummy_dword,f)) |
| 20938 | { | ||
| 20939 | ✗ | return qe_invalid; | |
| 20940 | } | ||
| 20941 | |||
| 20942 | //finally... section data | ||
| 20943 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_igetw(&item_drop_sets_to_read,f)) |
| 20944 | { | ||
| 20945 | ✗ | return qe_invalid; | |
| 20946 | } | ||
| 20947 | |||
| 20948 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | if (item_drop_sets_to_read > MAXITEMDROPSETS) |
| 20949 | { | ||
| 20950 | ✗ | return qe_invalid; | |
| 20951 | } | ||
| 20952 | 332 | } | |
| 20953 | else | ||
| 20954 | { | ||
| 20955 | 23 | init_item_drop_sets(); | |
| 20956 | } | ||
| 20957 | |||
| 20958 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 332 times.
|
355 | if(s_version>=1) |
| 20959 | { | ||
| 20960 |
2/2✓ Branch 0 taken 5151 times.
✓ Branch 1 taken 332 times.
|
5483 | for(int32_t i=0; i<item_drop_sets_to_read; i++) |
| 20961 | { | ||
| 20962 |
1/2✓ Branch 0 taken 5151 times.
✗ Branch 1 not taken.
|
5151 | if(!p_getstr(tempitemdrop.name,sizeof(tempitemdrop.name)-1,f)) |
| 20963 | { | ||
| 20964 | ✗ | return qe_invalid; | |
| 20965 | } | ||
| 20966 | |||
| 20967 |
2/2✓ Branch 0 taken 51510 times.
✓ Branch 1 taken 5151 times.
|
56661 | for(int32_t j=0; j<10; ++j) |
| 20968 | { | ||
| 20969 |
1/2✓ Branch 0 taken 51510 times.
✗ Branch 1 not taken.
|
51510 | if(!p_igetw(&tempitemdrop.item[j],f)) |
| 20970 | { | ||
| 20971 | ✗ | return qe_invalid; | |
| 20972 | } | ||
| 20973 | 51510 | } | |
| 20974 | |||
| 20975 |
2/2✓ Branch 0 taken 56661 times.
✓ Branch 1 taken 5151 times.
|
61812 | for(int32_t j=0; j<11; ++j) |
| 20976 | { | ||
| 20977 |
1/2✓ Branch 0 taken 56661 times.
✗ Branch 1 not taken.
|
56661 | if(!p_igetw(&tempitemdrop.chance[j],f)) |
| 20978 | { | ||
| 20979 | ✗ | return qe_invalid; | |
| 20980 | } | ||
| 20981 | 56661 | } | |
| 20982 | |||
| 20983 | // Dec 2008: Addition of the 'Tall Grass' set, #12, | ||
| 20984 | // overrides the quest's set #12. | ||
| 20985 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 5151 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5151 | if(s_version<2 && i==12) |
| 20986 | ✗ | continue; | |
| 20987 | |||
| 20988 | // Deprecated: qr_NOCLOCKS and qr_ALLOW10RUPEEDROPS | ||
| 20989 |
1/4✓ Branch 0 taken 5151 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5151 | if(s_version<2) for(int32_t j=0; j<10; ++j) |
| 20990 | { | ||
| 20991 | ✗ | int32_t it = tempitemdrop.item[j]; | |
| 20992 | |||
| 20993 | ✗ | if((itemsbuf[it].family == itype_rupee | |
| 20994 | ✗ | && ((itemsbuf[it].amount)&0xFFF) == 10) | |
| 20995 | ✗ | && !get_bit(deprecated_rules, qr_ALLOW10RUPEEDROPS_DEP)) | |
| 20996 | { | ||
| 20997 | ✗ | tempitemdrop.chance[j+1]=0; | |
| 20998 | ✗ | } | |
| 20999 | ✗ | else if(itemsbuf[it].family == itype_clock && get_bit(deprecated_rules, qr_NOCLOCKS_DEP)) | |
| 21000 | { | ||
| 21001 | ✗ | tempitemdrop.chance[j+1]=0; | |
| 21002 | ✗ | } | |
| 21003 | |||
| 21004 | // From Sept 2007 to Dec 2008, non-gameplay items were prohibited. | ||
| 21005 | ✗ | if(itemsbuf[it].family == itype_misc) | |
| 21006 | { | ||
| 21007 | // If a non-gameplay item was selected, then item drop was aborted. | ||
| 21008 | // Reflect this by increasing the 'Nothing' chance accordingly. | ||
| 21009 | ✗ | tempitemdrop.chance[0]+=tempitemdrop.chance[j+1]; | |
| 21010 | ✗ | tempitemdrop.chance[j+1]=0; | |
| 21011 | ✗ | } | |
| 21012 | ✗ | } | |
| 21013 | |||
| 21014 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5151 times.
|
5151 | if (!should_skip) |
| 21015 | 5151 | memcpy(&item_drop_sets[i], &tempitemdrop, sizeof(item_drop_object)); | |
| 21016 | 5151 | } | |
| 21017 | 332 | } | |
| 21018 | |||
| 21019 | 355 | return 0; | |
| 21020 | 355 | } | |
| 21021 | |||
| 21022 | 332 | int32_t readfavorites(PACKFILE *f, int32_t, word) | |
| 21023 | { | ||
| 21024 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_favorites); |
| 21025 | |||
| 21026 | int32_t temp_num; | ||
| 21027 | dword dummy_dword; | ||
| 21028 | word num_favorite_combos; | ||
| 21029 | word num_favorite_combo_aliases; | ||
| 21030 | 332 | word s_version=0, s_cversion=0; | |
| 21031 | |||
| 21032 | //section version info | ||
| 21033 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_igetw(&s_version,f)) |
| 21034 | { | ||
| 21035 | ✗ | return qe_invalid; | |
| 21036 | } | ||
| 21037 | |||
| 21038 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | if (!should_skip) |
| 21039 | 332 | FFCore.quest_format[vFavourites] = s_version; | |
| 21040 | |||
| 21041 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_igetw(&s_cversion,f)) |
| 21042 | { | ||
| 21043 | ✗ | return qe_invalid; | |
| 21044 | } | ||
| 21045 | |||
| 21046 | //section size | ||
| 21047 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_igetl(&dummy_dword,f)) |
| 21048 | { | ||
| 21049 | ✗ | return qe_invalid; | |
| 21050 | } | ||
| 21051 | |||
| 21052 | 332 | word per_row = FAVORITECOMBO_PER_ROW; | |
| 21053 | 332 | word per_page = FAVORITECOMBO_PER_PAGE; | |
| 21054 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 132 times.
|
332 | if(s_version >= 3) |
| 21055 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | if(!p_igetw(&per_row,f)) |
| 21056 | ✗ | return qe_invalid; | |
| 21057 |
2/2✓ Branch 0 taken 206 times.
✓ Branch 1 taken 126 times.
|
332 | if(s_version >= 4) |
| 21058 |
1/2✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
|
126 | if(!p_igetw(&per_page,f)) |
| 21059 | ✗ | return qe_invalid; | |
| 21060 | //finally... section data | ||
| 21061 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | if(!p_igetw(&num_favorite_combos,f)) |
| 21062 | { | ||
| 21063 | ✗ | return qe_invalid; | |
| 21064 | } | ||
| 21065 | |||
| 21066 | //Hack; port old favorite combos | ||
| 21067 |
3/4✓ Branch 0 taken 200 times.
✓ Branch 1 taken 132 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 200 times.
|
332 | if(s_version < 3 && num_favorite_combos == 100) |
| 21068 | 200 | per_row = 13; | |
| 21069 | |||
| 21070 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | if (!should_skip) |
| 21071 |
2/2✓ Branch 0 taken 418320 times.
✓ Branch 1 taken 332 times.
|
418652 | for(int q = 0; q < MAXFAVORITECOMBOS; ++q) |
| 21072 | 418652 | favorite_combos[q] = -1; | |
| 21073 | 332 | byte favtype = 0; | |
| 21074 |
2/2✓ Branch 0 taken 24286 times.
✓ Branch 1 taken 332 times.
|
24618 | for(int32_t i=0; i<num_favorite_combos; i++) |
| 21075 | { | ||
| 21076 |
2/2✓ Branch 0 taken 4280 times.
✓ Branch 1 taken 20006 times.
|
24286 | if (s_version >= 4) |
| 21077 | { | ||
| 21078 |
1/2✓ Branch 0 taken 4280 times.
✗ Branch 1 not taken.
|
4280 | if (!p_getc(&favtype, f)) |
| 21079 | { | ||
| 21080 | ✗ | return qe_invalid; | |
| 21081 | } | ||
| 21082 | 4280 | } | |
| 21083 | else | ||
| 21084 | 20006 | favtype = 0; | |
| 21085 |
1/2✓ Branch 0 taken 24286 times.
✗ Branch 1 not taken.
|
24286 | if(!p_igetl(&temp_num,f)) |
| 21086 | { | ||
| 21087 | ✗ | return qe_invalid; | |
| 21088 | } | ||
| 21089 | |||
| 21090 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24286 times.
|
24286 | if (should_skip) |
| 21091 | ✗ | continue; | |
| 21092 | |||
| 21093 |
2/2✓ Branch 0 taken 4280 times.
✓ Branch 1 taken 20006 times.
|
24286 | if(per_row == FAVORITECOMBO_PER_ROW) |
| 21094 | { | ||
| 21095 | 4280 | favorite_combos[i] = temp_num; | |
| 21096 | 4280 | favorite_combo_modes[i] = favtype; | |
| 21097 | 4280 | } | |
| 21098 | else | ||
| 21099 | { | ||
| 21100 | 20006 | int new_i = (i%per_row) + (i/per_row)*FAVORITECOMBO_PER_ROW; | |
| 21101 | 20006 | favorite_combos[new_i]=temp_num; | |
| 21102 | 20006 | favorite_combo_modes[new_i] = favtype; | |
| 21103 | } | ||
| 21104 | 24286 | } | |
| 21105 | |||
| 21106 | // Discard the separate favorite aliases list from previous versions | ||
| 21107 |
2/2✓ Branch 0 taken 126 times.
✓ Branch 1 taken 206 times.
|
332 | if(s_version<4) |
| 21108 | { | ||
| 21109 |
1/2✓ Branch 0 taken 206 times.
✗ Branch 1 not taken.
|
206 | if (!p_igetw(&num_favorite_combo_aliases, f)) |
| 21110 | { | ||
| 21111 | ✗ | return qe_invalid; | |
| 21112 | } | ||
| 21113 | |||
| 21114 |
2/2✓ Branch 0 taken 20000 times.
✓ Branch 1 taken 206 times.
|
20206 | for (int32_t i = 0; i < num_favorite_combo_aliases; i++) |
| 21115 | { | ||
| 21116 |
1/2✓ Branch 0 taken 20000 times.
✗ Branch 1 not taken.
|
20000 | if (!p_igetl(&temp_num, f)) |
| 21117 | { | ||
| 21118 | ✗ | return qe_invalid; | |
| 21119 | } | ||
| 21120 | 20000 | } | |
| 21121 | 206 | } | |
| 21122 | |||
| 21123 | 332 | word max_combo_cols = 0; | |
| 21124 | 332 | word max_mappages = 0; | |
| 21125 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 132 times.
|
332 | if(s_version >= 2) |
| 21126 | { | ||
| 21127 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | if(!p_igetw(&max_combo_cols,f)) |
| 21128 | ✗ | return qe_invalid; | |
| 21129 | 132 | int32_t tmp = 0, tmp2 = 0, tmp3 = 0; | |
| 21130 |
2/2✓ Branch 0 taken 528 times.
✓ Branch 1 taken 132 times.
|
660 | for(int q = 0; q < max_combo_cols; ++q) |
| 21131 | { | ||
| 21132 |
1/2✓ Branch 0 taken 528 times.
✗ Branch 1 not taken.
|
528 | if(!p_igetl(&tmp,f)) |
| 21133 | ✗ | return qe_invalid; | |
| 21134 |
1/2✓ Branch 0 taken 528 times.
✗ Branch 1 not taken.
|
528 | if(!p_igetl(&tmp2,f)) |
| 21135 | ✗ | return qe_invalid; | |
| 21136 |
1/2✓ Branch 0 taken 528 times.
✗ Branch 1 not taken.
|
528 | if(!p_igetl(&tmp3,f)) |
| 21137 | ✗ | return qe_invalid; | |
| 21138 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 528 times.
|
528 | if(q < MAX_COMBO_COLS) |
| 21139 | { | ||
| 21140 | 528 | First[q] = tmp; | |
| 21141 | 528 | combo_alistpos[q] = tmp2; | |
| 21142 | 528 | combo_pool_listpos[q] = tmp3; | |
| 21143 | 528 | } | |
| 21144 | 528 | } | |
| 21145 | |||
| 21146 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | if(!p_igetw(&max_mappages,f)) |
| 21147 | ✗ | return qe_invalid; | |
| 21148 |
2/2✓ Branch 0 taken 1188 times.
✓ Branch 1 taken 132 times.
|
1320 | for(int q = 0; q < max_mappages; ++q) |
| 21149 | { | ||
| 21150 |
1/2✓ Branch 0 taken 1188 times.
✗ Branch 1 not taken.
|
1188 | if(!p_igetl(&tmp,f)) |
| 21151 | ✗ | return qe_invalid; | |
| 21152 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1188 times.
|
1188 | if(!p_igetl(&tmp2,f)) |
| 21153 | ✗ | return qe_invalid; | |
| 21154 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1188 times.
|
1188 | if(q < MAX_MAPPAGE_BTNS) |
| 21155 | { | ||
| 21156 | 1188 | map_page[q].map = tmp; | |
| 21157 | 1188 | map_page[q].screen = tmp2; | |
| 21158 | 1188 | } | |
| 21159 | 1188 | } | |
| 21160 | 132 | } | |
| 21161 | |||
| 21162 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | if (should_skip) |
| 21163 | ✗ | return 0; | |
| 21164 | |||
| 21165 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 332 times.
|
1132 | for(int q = max_combo_cols; q < MAX_COMBO_COLS; ++q) |
| 21166 | { | ||
| 21167 | 800 | First[q] = 0; | |
| 21168 | 800 | combo_alistpos[q] = 0; | |
| 21169 | 800 | combo_pool_listpos[q] = 0; | |
| 21170 | 800 | } | |
| 21171 |
2/2✓ Branch 0 taken 1800 times.
✓ Branch 1 taken 332 times.
|
2132 | for(int q = max_mappages; q < MAX_MAPPAGE_BTNS; ++q) |
| 21172 | { | ||
| 21173 | 1800 | map_page[q].map = 0; | |
| 21174 | 1800 | map_page[q].screen = 0; | |
| 21175 | 1800 | } | |
| 21176 | |||
| 21177 | 332 | return 0; | |
| 21178 | 332 | } | |
| 21179 | |||
| 21180 | /* | ||
| 21181 | switch (ret) { | ||
| 21182 | case 0: | ||
| 21183 | break; | ||
| 21184 | |||
| 21185 | case qe_invalid: | ||
| 21186 | goto invalid; | ||
| 21187 | break; | ||
| 21188 | default: | ||
| 21189 | pack_fclose(f); | ||
| 21190 | if(!oldquest) | ||
| 21191 | delete_file(tmpfilename); | ||
| 21192 | return ret; | ||
| 21193 | break; | ||
| 21194 | } | ||
| 21195 | */ | ||
| 21196 | |||
| 21197 | const char *skip_text[skip_max]= | ||
| 21198 | { | ||
| 21199 | "skip_header", "skip_rules", "skip_strings", "skip_misc", | ||
| 21200 | "skip_tiles", "skip_combos", "skip_comboaliases", "skip_csets", | ||
| 21201 | "skip_maps", "skip_dmaps", "skip_doors", "skip_items", | ||
| 21202 | "skip_weapons", "skip_colors", "skip_icons", "skip_initdata", | ||
| 21203 | "skip_guys", "skip_herosprites", "skip_subscreens", "skip_ffscript", | ||
| 21204 | "skip_sfx", "skip_midis", "skip_cheats", "skip_itemdropsets", | ||
| 21205 | "skip_favorites" | ||
| 21206 | }; | ||
| 21207 | |||
| 21208 | |||
| 21209 | ✗ | void port250QuestRules(){ | |
| 21210 | |||
| 21211 | ✗ | portCandleRules(); //Candle | |
| 21212 | ✗ | portBombRules(); | |
| 21213 | |||
| 21214 | ✗ | } | |
| 21215 | |||
| 21216 | ✗ | void portCandleRules() | |
| 21217 | { | ||
| 21218 | ✗ | bool hurtshero = get_qr(qr_FIREPROOFHERO); | |
| 21219 | //itemdata itemsbuf; | ||
| 21220 | ✗ | for ( int32_t q = 0; q < MAXITEMS; q++ ) | |
| 21221 | { | ||
| 21222 | ✗ | if ( itemsbuf[q].family == itype_candle ) | |
| 21223 | { | ||
| 21224 | ✗ | if ( hurtshero ) itemsbuf[q].flags |= item_flag2; | |
| 21225 | ✗ | else itemsbuf[q].flags &= ~ item_flag2; | |
| 21226 | ✗ | } | |
| 21227 | ✗ | } | |
| 21228 | ✗ | } | |
| 21229 | |||
| 21230 | ✗ | void portBombRules() | |
| 21231 | { | ||
| 21232 | ✗ | bool hurtshero = get_qr(qr_OUCHBOMBS); | |
| 21233 | //itemdata itemsbuf; | ||
| 21234 | ✗ | for ( int32_t q = 0; q < MAXITEMS; q++ ) | |
| 21235 | { | ||
| 21236 | ✗ | if ( itemsbuf[q].family == itype_bomb ) | |
| 21237 | { | ||
| 21238 | ✗ | if ( hurtshero ) itemsbuf[q].flags |= item_flag2; | |
| 21239 | ✗ | else itemsbuf[q].flags &= ~ item_flag2; | |
| 21240 | ✗ | } | |
| 21241 | ✗ | } | |
| 21242 | ✗ | } | |
| 21243 | |||
| 21244 | 15861 | static int section_id_to_enum(int id) | |
| 21245 | { | ||
| 21246 |
24/27✗ Branch 0 not taken.
✓ Branch 1 taken 690 times.
✓ Branch 2 taken 690 times.
✓ Branch 3 taken 690 times.
✓ Branch 4 taken 690 times.
✓ Branch 5 taken 690 times.
✓ Branch 6 taken 607 times.
✓ Branch 7 taken 690 times.
✓ Branch 8 taken 690 times.
✓ Branch 9 taken 690 times.
✓ Branch 10 taken 690 times.
✓ Branch 11 taken 690 times.
✓ Branch 12 taken 690 times.
✓ Branch 13 taken 607 times.
✓ Branch 14 taken 607 times.
✓ Branch 15 taken 690 times.
✓ Branch 16 taken 690 times.
✓ Branch 17 taken 631 times.
✓ Branch 18 taken 607 times.
✓ Branch 19 taken 607 times.
✓ Branch 20 taken 607 times.
✓ Branch 21 taken 690 times.
✓ Branch 22 taken 690 times.
✓ Branch 23 taken 631 times.
✓ Branch 24 taken 607 times.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
|
15861 | switch (id) |
| 21247 | { | ||
| 21248 | ✗ | case ID_HEADER: return skip_header; | |
| 21249 | 690 | case ID_RULES: return skip_rules; | |
| 21250 | 690 | case ID_STRINGS: return skip_strings; | |
| 21251 | 690 | case ID_MISC: return skip_misc; | |
| 21252 | 690 | case ID_TILES: return skip_tiles; | |
| 21253 | 690 | case ID_COMBOS: return skip_combos; | |
| 21254 | 607 | case ID_COMBOALIASES: return skip_comboaliases; | |
| 21255 | 690 | case ID_CSETS: return skip_csets; | |
| 21256 | 690 | case ID_MAPS: return skip_maps; | |
| 21257 | 690 | case ID_DMAPS: return skip_dmaps; | |
| 21258 | 690 | case ID_DOORS: return skip_doors; | |
| 21259 | 690 | case ID_ITEMS: return skip_items; | |
| 21260 | 690 | case ID_WEAPONS: return skip_weapons; | |
| 21261 | 607 | case ID_COLORS: return skip_colors; | |
| 21262 | 607 | case ID_ICONS: return skip_icons; | |
| 21263 | 690 | case ID_INITDATA: return skip_initdata; | |
| 21264 | 690 | case ID_GUYS: return skip_guys; | |
| 21265 | 631 | case ID_HEROSPRITES: return skip_herosprites; | |
| 21266 | 607 | case ID_SUBSCREEN: return skip_subscreens; | |
| 21267 | 607 | case ID_FFSCRIPT: return skip_ffscript; | |
| 21268 | 607 | case ID_SFX: return skip_sfx; | |
| 21269 | 690 | case ID_MIDIS: return skip_midis; | |
| 21270 | 690 | case ID_CHEATS: return skip_cheats; | |
| 21271 | 631 | case ID_ITEMDROPSETS: return skip_itemdropsets; | |
| 21272 | 607 | case ID_FAVORITES: return skip_favorites; | |
| 21273 | ✗ | case ID_ZINFO: return skip_zinfo; | |
| 21274 | } | ||
| 21275 | |||
| 21276 | ✗ | return -1; | |
| 21277 | 15861 | } | |
| 21278 | |||
| 21279 | 15453 | static int maybe_skip_section(PACKFILE* f, dword& section_id, const byte* skip_flags) | |
| 21280 | { | ||
| 21281 | 15453 | int section_enum = section_id_to_enum(section_id); | |
| 21282 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15453 times.
|
15453 | bool skip = section_enum >= 0 && get_bit(skip_flags, section_enum); |
| 21283 |
2/2✓ Branch 0 taken 5775 times.
✓ Branch 1 taken 9678 times.
|
15453 | if (skip) |
| 21284 | { | ||
| 21285 | word s_version; | ||
| 21286 |
1/2✓ Branch 0 taken 5775 times.
✗ Branch 1 not taken.
|
5775 | if (!p_igetw(&s_version,f)) |
| 21287 | { | ||
| 21288 | ✗ | return qe_invalid; | |
| 21289 | } | ||
| 21290 | |||
| 21291 | word c_version; | ||
| 21292 |
1/2✓ Branch 0 taken 5775 times.
✗ Branch 1 not taken.
|
5775 | if (!p_igetw(&c_version,f)) |
| 21293 | { | ||
| 21294 | ✗ | return qe_invalid; | |
| 21295 | } | ||
| 21296 | |||
| 21297 |
3/4✓ Branch 0 taken 275 times.
✓ Branch 1 taken 5500 times.
✓ Branch 2 taken 275 times.
✗ Branch 3 not taken.
|
5775 | if (section_id == ID_RULES && s_version > 16) |
| 21298 | { | ||
| 21299 | dword dummy; | ||
| 21300 | ✗ | if (!p_igetl(&dummy,f)) | |
| 21301 | { | ||
| 21302 | ✗ | return qe_invalid; | |
| 21303 | } | ||
| 21304 | ✗ | } | |
| 21305 | |||
| 21306 |
3/4✓ Branch 0 taken 275 times.
✓ Branch 1 taken 5500 times.
✓ Branch 2 taken 275 times.
✗ Branch 3 not taken.
|
5775 | if (section_id == ID_FFSCRIPT && s_version >= 18) |
| 21307 | { | ||
| 21308 | word dummy; | ||
| 21309 | ✗ | if (!p_igetw(&dummy,f)) | |
| 21310 | { | ||
| 21311 | ✗ | return qe_invalid; | |
| 21312 | } | ||
| 21313 | ✗ | } | |
| 21314 | |||
| 21315 | dword section_length; | ||
| 21316 |
1/2✓ Branch 0 taken 5775 times.
✗ Branch 1 not taken.
|
5775 | if (!p_igetl(§ion_length,f)) |
| 21317 | { | ||
| 21318 | ✗ | return qe_invalid; | |
| 21319 | } | ||
| 21320 | |||
| 21321 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5775 times.
|
5775 | if (pack_fseek(f, section_length)) |
| 21322 | { | ||
| 21323 | ✗ | return qe_invalid; | |
| 21324 | } | ||
| 21325 | |||
| 21326 |
2/2✓ Branch 0 taken 275 times.
✓ Branch 1 taken 5500 times.
|
5775 | if (!pack_feof(f)) |
| 21327 | { | ||
| 21328 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5500 times.
|
5500 | if (!p_mgetl(§ion_id,f)) |
| 21329 | { | ||
| 21330 | ✗ | return qe_invalid; | |
| 21331 | } | ||
| 21332 | 5500 | } | |
| 21333 | |||
| 21334 | 5775 | return qe_cancel; | |
| 21335 | } | ||
| 21336 | |||
| 21337 | 9678 | return qe_OK; | |
| 21338 | 15453 | } | |
| 21339 | |||
| 21340 | //Internal function for loadquest wrapper | ||
| 21341 | 690 | static int32_t _lq_int(const char *filename, zquestheader *Header, miscQdata *Misc, zctune *tunes, bool show_progress, byte *skip_flags, byte printmetadata) | |
| 21342 | { | ||
| 21343 | 690 | DMapEditorLastMaptileUsed = 0; | |
| 21344 | 690 | combosread=false; | |
| 21345 | 690 | mapsread=false; | |
| 21346 | 690 | fixffcs=false; | |
| 21347 | |||
| 21348 | 690 | bool do_clear_scripts = !get_bit(skip_flags,skip_ffscript); | |
| 21349 |
1/2✓ Branch 0 taken 690 times.
✗ Branch 1 not taken.
|
690 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 21350 | { | ||
| 21351 | ✗ | set_bit(skip_flags, skip_ffscript, 1); | |
| 21352 | ✗ | setZScriptVersion(V_FFSCRIPT); | |
| 21353 | ✗ | FFCore.quest_format[vFFScript] = V_FFSCRIPT; | |
| 21354 | ✗ | FFCore.quest_format[vLastCompile] = V_FFSCRIPT; | |
| 21355 | ✗ | do_clear_scripts = true; | |
| 21356 | ✗ | } | |
| 21357 |
1/2✓ Branch 0 taken 690 times.
✗ Branch 1 not taken.
|
690 | if(loading_tileset_flags & TILESET_CLEARMAPS) |
| 21358 | { | ||
| 21359 | ✗ | set_bit(skip_flags, skip_maps, 1); | |
| 21360 | ✗ | } | |
| 21361 | |||
| 21362 | // show_progress=true; | ||
| 21363 | char tmpfilename[L_tmpnam]; | ||
| 21364 | 690 | temp_name(tmpfilename); | |
| 21365 | // char percent_done[30]; | ||
| 21366 | 690 | bool catchup=false; | |
| 21367 | byte tempbyte; | ||
| 21368 | 690 | word old_map_count=map_count; | |
| 21369 | |||
| 21370 | 690 | byte old_quest_rules[QUESTRULES_NEW_SIZE] = {0}; | |
| 21371 | 690 | byte old_extra_rules[EXTRARULES_SIZE] = {0}; | |
| 21372 | 690 | byte old_midi_flags[MIDIFLAGS_SIZE] = {0}; | |
| 21373 | |||
| 21374 |
2/2✓ Branch 0 taken 276 times.
✓ Branch 1 taken 414 times.
|
690 | if(get_bit(skip_flags, skip_rules)) |
| 21375 | { | ||
| 21376 | 276 | memcpy(old_quest_rules, quest_rules, QUESTRULES_NEW_SIZE); | |
| 21377 | 276 | memcpy(old_extra_rules, extra_rules, EXTRARULES_SIZE); | |
| 21378 | 276 | } | |
| 21379 | |||
| 21380 | 690 | memset(quest_rules, 0, QUESTRULES_NEW_SIZE); //clear here to prevent any kind of carryover -Z | |
| 21381 | 690 | unpack_qrs(); | |
| 21382 | // memset(extra_rules, 0, EXTRARULES_SIZE); //clear here to prevent any kind of carryover -Z | ||
| 21383 | |||
| 21384 |
2/2✓ Branch 0 taken 276 times.
✓ Branch 1 taken 414 times.
|
690 | if(get_bit(skip_flags, skip_midis)) |
| 21385 | { | ||
| 21386 | 276 | memcpy(old_midi_flags, midi_flags, MIDIFLAGS_SIZE); | |
| 21387 | 276 | } | |
| 21388 | |||
| 21389 | |||
| 21390 |
2/2✓ Branch 0 taken 276 times.
✓ Branch 1 taken 414 times.
|
690 | if(do_clear_scripts) |
| 21391 | { | ||
| 21392 | 414 | zScript.clear(); | |
| 21393 | 414 | globalmap.clear(); | |
| 21394 | 414 | genericmap.clear(); | |
| 21395 | 414 | ffcmap.clear(); | |
| 21396 | 414 | itemmap.clear(); | |
| 21397 | 414 | npcmap.clear(); | |
| 21398 | 414 | ewpnmap.clear(); | |
| 21399 | 414 | lwpnmap.clear(); | |
| 21400 | 414 | playermap.clear(); | |
| 21401 | 414 | dmapmap.clear(); | |
| 21402 | 414 | screenmap.clear(); | |
| 21403 | 414 | itemspritemap.clear(); | |
| 21404 | 414 | comboscriptmap.clear(); | |
| 21405 | 414 | subscreenmap.clear(); | |
| 21406 | |||
| 21407 |
2/2✓ Branch 0 taken 211554 times.
✓ Branch 1 taken 414 times.
|
211968 | for(int32_t i=0; i<NUMSCRIPTFFC-1; i++) |
| 21408 | { | ||
| 21409 | 211554 | ffcmap[i].clear(); | |
| 21410 | 211554 | } | |
| 21411 | |||
| 21412 | 414 | globalmap[0].slotname = "Slot 1:"; | |
| 21413 | 414 | globalmap[0].scriptname = "~Init"; | |
| 21414 | 414 | globalmap[0].update(); | |
| 21415 | |||
| 21416 |
2/2✓ Branch 0 taken 2898 times.
✓ Branch 1 taken 414 times.
|
3312 | for(int32_t i=1; i<NUMSCRIPTGLOBAL; i++) |
| 21417 | { | ||
| 21418 | 2898 | globalmap[i].clear(); | |
| 21419 | 2898 | } | |
| 21420 | |||
| 21421 |
2/2✓ Branch 0 taken 105570 times.
✓ Branch 1 taken 414 times.
|
105984 | for(int32_t i=0; i<NUMSCRIPTITEM-1; i++) |
| 21422 | { | ||
| 21423 | 105570 | itemmap[i].clear(); | |
| 21424 | 105570 | } | |
| 21425 | |||
| 21426 | //new script types -- prevent carrying over to a quest that you load after reading them | ||
| 21427 | //e.g., a quest has an npc script, and you make a blank quest, that now believes that it has an npc script, too! | ||
| 21428 |
2/2✓ Branch 0 taken 105570 times.
✓ Branch 1 taken 414 times.
|
105984 | for(int32_t i=0; i<NUMSCRIPTGUYS-1; i++) |
| 21429 | { | ||
| 21430 | 105570 | npcmap[i].clear(); | |
| 21431 | 105570 | } | |
| 21432 |
2/2✓ Branch 0 taken 105570 times.
✓ Branch 1 taken 414 times.
|
105984 | for(int32_t i=0; i<NUMSCRIPTWEAPONS-1; i++) |
| 21433 | { | ||
| 21434 | 105570 | lwpnmap[i].clear(); | |
| 21435 | 105570 | } | |
| 21436 |
2/2✓ Branch 0 taken 105570 times.
✓ Branch 1 taken 414 times.
|
105984 | for(int32_t i=0; i<NUMSCRIPTWEAPONS-1; i++) |
| 21437 | { | ||
| 21438 | 105570 | ewpnmap[i].clear(); | |
| 21439 | 105570 | } | |
| 21440 |
2/2✓ Branch 0 taken 1656 times.
✓ Branch 1 taken 414 times.
|
2070 | for(int32_t i=0; i<NUMSCRIPTPLAYER-1; i++) |
| 21441 | { | ||
| 21442 | 1656 | playermap[i].clear(); | |
| 21443 | 1656 | } | |
| 21444 |
2/2✓ Branch 0 taken 105570 times.
✓ Branch 1 taken 414 times.
|
105984 | for(int32_t i=0; i<NUMSCRIPTSDMAP-1; i++) |
| 21445 | { | ||
| 21446 | 105570 | dmapmap[i].clear(); | |
| 21447 | 105570 | } | |
| 21448 |
2/2✓ Branch 0 taken 105570 times.
✓ Branch 1 taken 414 times.
|
105984 | for(int32_t i=0; i<NUMSCRIPTSCREEN-1; i++) |
| 21449 | { | ||
| 21450 | 105570 | screenmap[i].clear(); | |
| 21451 | 105570 | } | |
| 21452 |
2/2✓ Branch 0 taken 105570 times.
✓ Branch 1 taken 414 times.
|
105984 | for(int32_t i=0; i<NUMSCRIPTSITEMSPRITE-1; i++) |
| 21453 | { | ||
| 21454 | 105570 | itemspritemap[i].clear(); | |
| 21455 | 105570 | } | |
| 21456 |
2/2✓ Branch 0 taken 211554 times.
✓ Branch 1 taken 414 times.
|
211968 | for(int32_t i=0; i<NUMSCRIPTSCOMBODATA-1; i++) |
| 21457 | { | ||
| 21458 | 211554 | comboscriptmap[i].clear(); | |
| 21459 | 211554 | } | |
| 21460 |
2/2✓ Branch 0 taken 211554 times.
✓ Branch 1 taken 414 times.
|
211968 | for(int32_t i=0; i<NUMSCRIPTSGENERIC-1; i++) |
| 21461 | { | ||
| 21462 | 211554 | genericmap[i].clear(); | |
| 21463 | 211554 | } | |
| 21464 |
2/2✓ Branch 0 taken 105570 times.
✓ Branch 1 taken 414 times.
|
105984 | for(int32_t i=0; i<NUMSCRIPTSSUBSCREEN-1; i++) |
| 21465 | { | ||
| 21466 | 105570 | subscreenmap[i].clear(); | |
| 21467 | 105570 | } | |
| 21468 | |||
| 21469 | 414 | reset_scripts(); | |
| 21470 | 414 | } | |
| 21471 | |||
| 21472 | zquestheader tempheader; | ||
| 21473 | 690 | memset(&tempheader, 0, sizeof(zquestheader)); | |
| 21474 | 690 | zinfo tempzi; | |
| 21475 | 690 | tempzi.clear(); | |
| 21476 | 690 | load_tmp_zi = &tempzi; | |
| 21477 | |||
| 21478 | // oldquest flag is set when an unencrypted qst file is suspected. | ||
| 21479 | 690 | bool oldquest = false; | |
| 21480 | 690 | int32_t open_error=0; | |
| 21481 | 690 | PACKFILE *f=open_quest_file(&open_error, filename, show_progress); | |
| 21482 | |||
| 21483 |
1/2✓ Branch 0 taken 690 times.
✗ Branch 1 not taken.
|
690 | if (!f) |
| 21484 | { | ||
| 21485 | ASSERT(open_error != 0); | ||
| 21486 | ✗ | return open_error; | |
| 21487 | } | ||
| 21488 | char zinfofilename[2048]; | ||
| 21489 | 690 | replace_extension(zinfofilename, filename, "zinfo", 2047); | |
| 21490 | 690 | int32_t ret=0; | |
| 21491 | |||
| 21492 | //header | ||
| 21493 | 690 | box_out("Reading Header..."); | |
| 21494 | 690 | ret=readheader(f, &tempheader, printmetadata); | |
| 21495 |
1/5✗ Branch 0 not taken.
✓ Branch 1 taken 690 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
690 | checkstatus(ret); |
| 21496 | 690 | box_out("okay."); | |
| 21497 | 690 | box_eol(); | |
| 21498 | |||
| 21499 |
2/2✓ Branch 0 taken 547 times.
✓ Branch 1 taken 143 times.
|
690 | if(read_zinfo) |
| 21500 | { | ||
| 21501 | 143 | box_out("Reading ZInfo - "); | |
| 21502 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 140 times.
|
143 | box_out(read_ext_zinfo ? "External..." : "Internal..."); |
| 21503 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 140 times.
|
143 | if(read_ext_zinfo) |
| 21504 | { | ||
| 21505 | 3 | PACKFILE *inf=pack_fopen_password(zinfofilename, F_READ, ""); | |
| 21506 | 3 | ret=readzinfo(inf, tempzi, tempheader); | |
| 21507 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if(inf) pack_fclose(inf); |
| 21508 |
1/5✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
3 | checkstatus(ret); |
| 21509 | 3 | } | |
| 21510 | else | ||
| 21511 | { | ||
| 21512 | 140 | ret=readzinfo(f, tempzi, tempheader); | |
| 21513 |
1/5✗ Branch 0 not taken.
✓ Branch 1 taken 140 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
140 | checkstatus(ret); |
| 21514 | } | ||
| 21515 | 143 | box_out("okay."); | |
| 21516 | 143 | box_eol(); | |
| 21517 | 143 | } | |
| 21518 | |||
| 21519 |
2/2✓ Branch 0 taken 666 times.
✓ Branch 1 taken 24 times.
|
690 | if(tempheader.zelda_version>=0x193) |
| 21520 | { | ||
| 21521 | dword section_id; | ||
| 21522 | |||
| 21523 | //section id | ||
| 21524 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | if(!p_mgetl(§ion_id,f)) |
| 21525 | { | ||
| 21526 | ✗ | goto invalid; | |
| 21527 | } | ||
| 21528 | |||
| 21529 | 666 | std::set<dword> seen_sections; | |
| 21530 | |||
| 21531 |
3/4✓ Branch 0 taken 16119 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15453 times.
✓ Branch 3 taken 666 times.
|
16119 | while(!pack_feof(f)) |
| 21532 | { | ||
| 21533 |
2/4✓ Branch 0 taken 15453 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15453 times.
✗ Branch 3 not taken.
|
15453 | if (seen_sections.contains(section_id)) |
| 21534 | ✗ | goto invalid; | |
| 21535 |
1/2✓ Branch 0 taken 15453 times.
✗ Branch 1 not taken.
|
15453 | seen_sections.insert(section_id); |
| 21536 | |||
| 21537 |
3/4✓ Branch 0 taken 15453 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9678 times.
✓ Branch 3 taken 5775 times.
|
15453 | if (int retval = maybe_skip_section(f, section_id, skip_flags); retval != qe_OK) |
| 21538 | { | ||
| 21539 |
1/2✓ Branch 0 taken 5775 times.
✗ Branch 1 not taken.
|
5775 | if (retval == qe_cancel) |
| 21540 | 5775 | continue; | |
| 21541 | ✗ | checkstatus(retval); | |
| 21542 | ✗ | } | |
| 21543 | |||
| 21544 |
24/25✓ Branch 0 taken 391 times.
✓ Branch 1 taken 391 times.
✓ Branch 2 taken 666 times.
✓ Branch 3 taken 666 times.
✓ Branch 4 taken 391 times.
✓ Branch 5 taken 332 times.
✓ Branch 6 taken 666 times.
✓ Branch 7 taken 391 times.
✓ Branch 8 taken 391 times.
✓ Branch 9 taken 391 times.
✓ Branch 10 taken 391 times.
✓ Branch 11 taken 391 times.
✓ Branch 12 taken 332 times.
✓ Branch 13 taken 332 times.
✓ Branch 14 taken 391 times.
✓ Branch 15 taken 391 times.
✓ Branch 16 taken 332 times.
✓ Branch 17 taken 332 times.
✓ Branch 18 taken 332 times.
✓ Branch 19 taken 332 times.
✓ Branch 20 taken 391 times.
✓ Branch 21 taken 391 times.
✓ Branch 22 taken 332 times.
✓ Branch 23 taken 332 times.
✗ Branch 24 not taken.
|
9678 | switch(section_id) |
| 21545 | { | ||
| 21546 | case ID_RULES: | ||
| 21547 | |||
| 21548 | //rules | ||
| 21549 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
|
391 | if(catchup) |
| 21550 | { | ||
| 21551 | ✗ | box_out("found."); | |
| 21552 | ✗ | box_eol(); | |
| 21553 | ✗ | catchup=false; | |
| 21554 | ✗ | } | |
| 21555 | |||
| 21556 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_out("Reading Rules..."); |
| 21557 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | ret=readrules(f, &tempheader); |
| 21558 |
1/9✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 391 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
391 | checkstatus(ret); |
| 21559 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_out("okay."); |
| 21560 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_eol(); |
| 21561 | 391 | break; | |
| 21562 | |||
| 21563 | case ID_STRINGS: | ||
| 21564 | |||
| 21565 | //strings | ||
| 21566 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
|
391 | if(catchup) |
| 21567 | { | ||
| 21568 | ✗ | box_out("found."); | |
| 21569 | ✗ | box_eol(); | |
| 21570 | ✗ | catchup=false; | |
| 21571 | ✗ | } | |
| 21572 | |||
| 21573 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_out("Reading Strings..."); |
| 21574 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | ret=readstrings(f, &tempheader); |
| 21575 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
391 | checkstatus(ret); |
| 21576 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_out("okay."); |
| 21577 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_eol(); |
| 21578 | 391 | break; | |
| 21579 | |||
| 21580 | case ID_MISC: | ||
| 21581 | |||
| 21582 | //misc data | ||
| 21583 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 666 times.
|
666 | if(catchup) |
| 21584 | { | ||
| 21585 | ✗ | box_out("found."); | |
| 21586 | ✗ | box_eol(); | |
| 21587 | ✗ | catchup=false; | |
| 21588 | ✗ | } | |
| 21589 | |||
| 21590 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | box_out("Reading Misc. Data..."); |
| 21591 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | ret=readmisc(f, &tempheader, Misc); |
| 21592 |
1/9✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
666 | checkstatus(ret); |
| 21593 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | box_out("okay."); |
| 21594 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | box_eol(); |
| 21595 | 666 | break; | |
| 21596 | |||
| 21597 | case ID_TILES: | ||
| 21598 | |||
| 21599 | //tiles | ||
| 21600 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 666 times.
|
666 | if(catchup) |
| 21601 | { | ||
| 21602 | ✗ | box_out("found."); | |
| 21603 | ✗ | box_eol(); | |
| 21604 | ✗ | catchup=false; | |
| 21605 | ✗ | } | |
| 21606 | |||
| 21607 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | box_out("Reading Tiles..."); |
| 21608 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | ret=readtiles(f, newtilebuf, &tempheader, tempheader.zelda_version, tempheader.build, 0, NEWMAXTILES, false); |
| 21609 |
1/9✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
666 | checkstatus(ret); |
| 21610 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | box_out("okay."); |
| 21611 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | box_eol(); |
| 21612 | 666 | break; | |
| 21613 | |||
| 21614 | case ID_COMBOS: | ||
| 21615 | |||
| 21616 | //combos | ||
| 21617 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
|
391 | if(catchup) |
| 21618 | { | ||
| 21619 | ✗ | box_out("found."); | |
| 21620 | ✗ | box_eol(); | |
| 21621 | ✗ | catchup=false; | |
| 21622 | ✗ | } | |
| 21623 | |||
| 21624 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_out("Reading Combos..."); |
| 21625 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | ret=readcombos(f, &tempheader, tempheader.zelda_version, tempheader.build, 0, MAXCOMBOS); |
| 21626 | 391 | combosread=true; | |
| 21627 |
1/9✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
391 | checkstatus(ret); |
| 21628 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_out("okay."); |
| 21629 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_eol(); |
| 21630 | 391 | break; | |
| 21631 | |||
| 21632 | case ID_COMBOALIASES: | ||
| 21633 | |||
| 21634 | //combo aliases | ||
| 21635 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | if(catchup) |
| 21636 | { | ||
| 21637 | ✗ | box_out("found."); | |
| 21638 | ✗ | box_eol(); | |
| 21639 | ✗ | catchup=false; | |
| 21640 | ✗ | } | |
| 21641 | |||
| 21642 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | box_out("Reading Combo Aliases..."); |
| 21643 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | ret=readcomboaliases(f, &tempheader, tempheader.zelda_version, tempheader.build); |
| 21644 |
1/9✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
332 | checkstatus(ret); |
| 21645 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | box_out("okay."); |
| 21646 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | box_eol(); |
| 21647 | 332 | break; | |
| 21648 | |||
| 21649 | case ID_CSETS: | ||
| 21650 | |||
| 21651 | //color data | ||
| 21652 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 666 times.
|
666 | if(catchup) |
| 21653 | { | ||
| 21654 | ✗ | box_out("found."); | |
| 21655 | ✗ | box_eol(); | |
| 21656 | ✗ | catchup=false; | |
| 21657 | ✗ | } | |
| 21658 | |||
| 21659 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | box_out("Reading Color Data..."); |
| 21660 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | ret=readcolordata(f, Misc, tempheader.zelda_version, tempheader.build, 0, newerpdTOTAL); |
| 21661 |
1/9✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
666 | checkstatus(ret); |
| 21662 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | box_out("okay."); |
| 21663 |
1/2✓ Branch 0 taken 666 times.
✗ Branch 1 not taken.
|
666 | box_eol(); |
| 21664 | 666 | break; | |
| 21665 | |||
| 21666 | case ID_MAPS: | ||
| 21667 | |||
| 21668 | //maps | ||
| 21669 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
|
391 | if(catchup) |
| 21670 | { | ||
| 21671 | ✗ | box_out("found."); | |
| 21672 | ✗ | box_eol(); | |
| 21673 | ✗ | catchup=false; | |
| 21674 | ✗ | } | |
| 21675 | |||
| 21676 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_out("Reading Maps..."); |
| 21677 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | ret=readmaps(f, &tempheader); |
| 21678 | 391 | mapsread=true; | |
| 21679 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
391 | checkstatus(ret); |
| 21680 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_out("okay."); |
| 21681 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_eol(); |
| 21682 | 391 | break; | |
| 21683 | |||
| 21684 | case ID_DMAPS: | ||
| 21685 | |||
| 21686 | //dmaps | ||
| 21687 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
|
391 | if(catchup) |
| 21688 | { | ||
| 21689 | ✗ | box_out("found."); | |
| 21690 | ✗ | box_eol(); | |
| 21691 | ✗ | catchup=false; | |
| 21692 | ✗ | } | |
| 21693 | |||
| 21694 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_out("Reading DMaps..."); |
| 21695 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | ret=readdmaps(f, &tempheader, tempheader.zelda_version, tempheader.build, 0, MAXDMAPS); |
| 21696 |
1/9✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
391 | checkstatus(ret); |
| 21697 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_out("okay."); |
| 21698 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_eol(); |
| 21699 | 391 | break; | |
| 21700 | |||
| 21701 | case ID_DOORS: | ||
| 21702 | |||
| 21703 | //door combo sets | ||
| 21704 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
|
391 | if(catchup) |
| 21705 | { | ||
| 21706 | ✗ | box_out("found."); | |
| 21707 | ✗ | box_eol(); | |
| 21708 | ✗ | catchup=false; | |
| 21709 | ✗ | } | |
| 21710 | |||
| 21711 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_out("Reading Doors..."); |
| 21712 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | ret=readdoorcombosets(f, &tempheader); |
| 21713 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
391 | checkstatus(ret); |
| 21714 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_out("okay."); |
| 21715 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_eol(); |
| 21716 | 391 | break; | |
| 21717 | |||
| 21718 | case ID_ITEMS: | ||
| 21719 | |||
| 21720 | //items | ||
| 21721 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
|
391 | if(catchup) |
| 21722 | { | ||
| 21723 | ✗ | box_out("found."); | |
| 21724 | ✗ | box_eol(); | |
| 21725 | ✗ | catchup=false; | |
| 21726 | ✗ | } | |
| 21727 | |||
| 21728 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_out("Reading Items..."); |
| 21729 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | ret=readitems(f, tempheader.zelda_version, tempheader.build); |
| 21730 |
1/9✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
391 | checkstatus(ret); |
| 21731 | |||
| 21732 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_out("okay."); |
| 21733 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_eol(); |
| 21734 | 391 | break; | |
| 21735 | |||
| 21736 | case ID_WEAPONS: | ||
| 21737 | |||
| 21738 | //weapons | ||
| 21739 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
|
391 | if(catchup) |
| 21740 | { | ||
| 21741 | ✗ | box_out("found."); | |
| 21742 | ✗ | box_eol(); | |
| 21743 | ✗ | catchup=false; | |
| 21744 | ✗ | } | |
| 21745 | |||
| 21746 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_out("Reading Weapons..."); |
| 21747 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | ret=readweapons(f, &tempheader); |
| 21748 |
1/9✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
391 | checkstatus(ret); |
| 21749 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_out("okay."); |
| 21750 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_eol(); |
| 21751 | 391 | break; | |
| 21752 | |||
| 21753 | case ID_COLORS: | ||
| 21754 | |||
| 21755 | //misc. colors | ||
| 21756 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | if(catchup) |
| 21757 | { | ||
| 21758 | ✗ | box_out("found."); | |
| 21759 | ✗ | box_eol(); | |
| 21760 | ✗ | catchup=false; | |
| 21761 | ✗ | } | |
| 21762 | |||
| 21763 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | box_out("Reading Misc. Colors..."); |
| 21764 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | ret=readmisccolors(f, &tempheader, Misc); |
| 21765 |
1/9✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
332 | checkstatus(ret); |
| 21766 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | box_out("okay."); |
| 21767 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | box_eol(); |
| 21768 | 332 | break; | |
| 21769 | |||
| 21770 | case ID_ICONS: | ||
| 21771 | |||
| 21772 | //game icons | ||
| 21773 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | if(catchup) |
| 21774 | { | ||
| 21775 | ✗ | box_out("found."); | |
| 21776 | ✗ | box_eol(); | |
| 21777 | ✗ | catchup=false; | |
| 21778 | ✗ | } | |
| 21779 | |||
| 21780 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | box_out("Reading Game Icons..."); |
| 21781 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | ret=readgameicons(f, &tempheader, Misc); |
| 21782 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
332 | checkstatus(ret); |
| 21783 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | box_out("okay."); |
| 21784 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | box_eol(); |
| 21785 | 332 | break; | |
| 21786 | |||
| 21787 | case ID_INITDATA: | ||
| 21788 | |||
| 21789 | //initialization data | ||
| 21790 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
|
391 | if(catchup) |
| 21791 | { | ||
| 21792 | ✗ | box_out("found."); | |
| 21793 | ✗ | box_eol(); | |
| 21794 | ✗ | catchup=false; | |
| 21795 | ✗ | } | |
| 21796 | |||
| 21797 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_out("Reading Init. Data..."); |
| 21798 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | ret=readinitdata(f, &tempheader); |
| 21799 |
1/9✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
391 | checkstatus(ret); |
| 21800 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_out("okay."); |
| 21801 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_eol(); |
| 21802 | |||
| 21803 |
2/4✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 391 times.
|
391 | if(!get_bit(skip_flags, skip_subscreens)) |
| 21804 | { | ||
| 21805 |
2/2✓ Branch 0 taken 84 times.
✓ Branch 1 taken 307 times.
|
391 | if(subscr_mode!=ssdtMAX) //not using custom subscreens |
| 21806 | { | ||
| 21807 |
1/2✓ Branch 0 taken 84 times.
✗ Branch 1 not taken.
|
84 | setupsubscreens(); |
| 21808 | |||
| 21809 |
2/2✓ Branch 0 taken 43008 times.
✓ Branch 1 taken 84 times.
|
43092 | for(int32_t i=0; i<MAXDMAPS; ++i) |
| 21810 | { | ||
| 21811 | 43008 | int32_t type=DMaps[i].type&dmfTYPE; | |
| 21812 |
2/2✓ Branch 0 taken 1076 times.
✓ Branch 1 taken 41932 times.
|
43008 | DMaps[i].active_subscreen=(type == dmOVERW || type == dmBSOVERW)?0:1; |
| 21813 | 43008 | DMaps[i].passive_subscreen=(get_qr(qr_ENABLEMAGIC))?0:1; | |
| 21814 | 43008 | } | |
| 21815 | 84 | } | |
| 21816 | 391 | } | |
| 21817 | |||
| 21818 |
2/4✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 391 times.
|
391 | if(!get_bit(skip_flags, skip_sfx)) |
| 21819 | { | ||
| 21820 | 391 | setupsfx(); | |
| 21821 | 391 | } | |
| 21822 | |||
| 21823 |
2/4✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 391 times.
✗ Branch 3 not taken.
|
391 | if(!get_bit(skip_flags, skip_itemdropsets)) |
| 21824 | { | ||
| 21825 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | init_item_drop_sets(); |
| 21826 | 391 | } | |
| 21827 | |||
| 21828 |
2/4✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 391 times.
|
391 | if(!get_bit(skip_flags, skip_favorites)) |
| 21829 | { | ||
| 21830 | 391 | init_favorites(); | |
| 21831 | 391 | } | |
| 21832 | |||
| 21833 | 391 | break; | |
| 21834 | |||
| 21835 | case ID_GUYS: | ||
| 21836 | |||
| 21837 | //guys | ||
| 21838 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
|
391 | if(catchup) |
| 21839 | { | ||
| 21840 | ✗ | box_out("found."); | |
| 21841 | ✗ | box_eol(); | |
| 21842 | ✗ | catchup=false; | |
| 21843 | ✗ | } | |
| 21844 | |||
| 21845 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_out("Reading Custom Guy Data..."); |
| 21846 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | ret=readguys(f, &tempheader); |
| 21847 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
391 | checkstatus(ret); |
| 21848 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_out("okay."); |
| 21849 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_eol(); |
| 21850 | 391 | break; | |
| 21851 | |||
| 21852 | case ID_HEROSPRITES: | ||
| 21853 | |||
| 21854 | //player sprites | ||
| 21855 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | if(catchup) |
| 21856 | { | ||
| 21857 | ✗ | box_out("found."); | |
| 21858 | ✗ | box_eol(); | |
| 21859 | ✗ | catchup=false; | |
| 21860 | ✗ | } | |
| 21861 | |||
| 21862 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | box_out("Reading Custom Player Sprite Data..."); |
| 21863 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | ret=readherosprites(f, &tempheader); |
| 21864 |
1/9✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
332 | checkstatus(ret); |
| 21865 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | box_out("okay."); |
| 21866 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | box_eol(); |
| 21867 | 332 | break; | |
| 21868 | |||
| 21869 | case ID_SUBSCREEN: | ||
| 21870 | |||
| 21871 | //custom subscreens | ||
| 21872 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | if(catchup) |
| 21873 | { | ||
| 21874 | ✗ | box_out("found."); | |
| 21875 | ✗ | box_eol(); | |
| 21876 | ✗ | catchup=false; | |
| 21877 | ✗ | } | |
| 21878 | |||
| 21879 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | box_out("Reading Custom Subscreen Data..."); |
| 21880 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | ret=readsubscreens(f); |
| 21881 |
1/9✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
332 | checkstatus(ret); |
| 21882 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | box_out("okay."); |
| 21883 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | box_eol(); |
| 21884 | 332 | break; | |
| 21885 | |||
| 21886 | case ID_FFSCRIPT: | ||
| 21887 | |||
| 21888 | //Freeform combo scripts | ||
| 21889 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | if(catchup) |
| 21890 | { | ||
| 21891 | ✗ | box_out("found."); | |
| 21892 | ✗ | box_eol(); | |
| 21893 | ✗ | catchup=false; | |
| 21894 | ✗ | } | |
| 21895 | |||
| 21896 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | box_out("Reading FF Script Data..."); |
| 21897 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | ret=readffscript(f, &tempheader); |
| 21898 |
1/9✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
332 | checkstatus(ret); |
| 21899 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | box_out("okay."); |
| 21900 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | box_eol(); |
| 21901 | 332 | break; | |
| 21902 | |||
| 21903 | case ID_SFX: | ||
| 21904 | |||
| 21905 | //SFX data | ||
| 21906 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | if(catchup) |
| 21907 | { | ||
| 21908 | ✗ | box_out("found."); | |
| 21909 | ✗ | box_eol(); | |
| 21910 | ✗ | catchup=false; | |
| 21911 | ✗ | } | |
| 21912 | |||
| 21913 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | box_out("Reading SFX Data..."); |
| 21914 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | ret=readsfx(f, &tempheader); |
| 21915 |
1/9✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
332 | checkstatus(ret); |
| 21916 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | box_out("okay."); |
| 21917 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | box_eol(); |
| 21918 | 332 | break; | |
| 21919 | |||
| 21920 | case ID_MIDIS: | ||
| 21921 | |||
| 21922 | //midis | ||
| 21923 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
|
391 | if(catchup) |
| 21924 | { | ||
| 21925 | ✗ | box_out("found."); | |
| 21926 | ✗ | box_eol(); | |
| 21927 | ✗ | catchup=false; | |
| 21928 | ✗ | } | |
| 21929 | |||
| 21930 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_out("Reading Tunes..."); |
| 21931 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | ret=readtunes(f, &tempheader, tunes); |
| 21932 |
1/9✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
391 | checkstatus(ret); |
| 21933 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_out("okay."); |
| 21934 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_eol(); |
| 21935 | 391 | break; | |
| 21936 | |||
| 21937 | case ID_CHEATS: | ||
| 21938 | |||
| 21939 | //cheat codes | ||
| 21940 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 391 times.
|
391 | if(catchup) |
| 21941 | { | ||
| 21942 | ✗ | box_out("found."); | |
| 21943 | ✗ | box_eol(); | |
| 21944 | ✗ | catchup=false; | |
| 21945 | ✗ | } | |
| 21946 | |||
| 21947 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_out("Reading Cheat Codes..."); |
| 21948 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | ret=readcheatcodes(f, &tempheader); |
| 21949 |
1/9✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
391 | checkstatus(ret); |
| 21950 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_out("okay."); |
| 21951 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | box_eol(); |
| 21952 | 391 | break; | |
| 21953 | |||
| 21954 | case ID_ITEMDROPSETS: | ||
| 21955 | |||
| 21956 | //item drop sets | ||
| 21957 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | if(catchup) |
| 21958 | { | ||
| 21959 | ✗ | box_out("found."); | |
| 21960 | ✗ | box_eol(); | |
| 21961 | ✗ | catchup=false; | |
| 21962 | ✗ | } | |
| 21963 | |||
| 21964 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | box_out("Reading Item Drop Sets..."); |
| 21965 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | ret=readitemdropsets(f, tempheader.zelda_version, tempheader.build); |
| 21966 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
332 | checkstatus(ret); |
| 21967 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | box_out("okay."); |
| 21968 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | box_eol(); |
| 21969 | 332 | break; | |
| 21970 | |||
| 21971 | case ID_FAVORITES: | ||
| 21972 | |||
| 21973 | //favorite combos and combo aliases | ||
| 21974 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 332 times.
|
332 | if(catchup) |
| 21975 | { | ||
| 21976 | ✗ | box_out("found."); | |
| 21977 | ✗ | box_eol(); | |
| 21978 | ✗ | catchup=false; | |
| 21979 | ✗ | } | |
| 21980 | |||
| 21981 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | box_out("Reading Favorite Combos..."); |
| 21982 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | ret=readfavorites(f, tempheader.zelda_version, tempheader.build); |
| 21983 |
1/9✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 332 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
332 | checkstatus(ret); |
| 21984 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | box_out("okay."); |
| 21985 |
1/2✓ Branch 0 taken 332 times.
✗ Branch 1 not taken.
|
332 | box_eol(); |
| 21986 | 332 | break; | |
| 21987 | |||
| 21988 | default: | ||
| 21989 | ✗ | if(!catchup) | |
| 21990 | { | ||
| 21991 | ✗ | box_out("Bad token! Searching..."); | |
| 21992 | ✗ | box_eol(); | |
| 21993 | ✗ | } | |
| 21994 | |||
| 21995 | ✗ | catchup=true; | |
| 21996 | ✗ | break; | |
| 21997 | } | ||
| 21998 | |||
| 21999 | |||
| 22000 |
1/2✓ Branch 0 taken 9678 times.
✗ Branch 1 not taken.
|
9678 | if(catchup) |
| 22001 | { | ||
| 22002 | //section id | ||
| 22003 | ✗ | section_id=(section_id<<8); | |
| 22004 | |||
| 22005 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 22006 | { | ||
| 22007 | ✗ | goto invalid; | |
| 22008 | } | ||
| 22009 | |||
| 22010 | ✗ | section_id+=tempbyte; | |
| 22011 | ✗ | } | |
| 22012 | |||
| 22013 | else | ||
| 22014 | { | ||
| 22015 | //section id | ||
| 22016 |
3/4✓ Branch 0 taken 9678 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9287 times.
✓ Branch 3 taken 391 times.
|
9678 | if(!pack_feof(f)) |
| 22017 | { | ||
| 22018 |
2/4✓ Branch 0 taken 9287 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9287 times.
✗ Branch 3 not taken.
|
9287 | if(!p_mgetl(§ion_id,f)) |
| 22019 | { | ||
| 22020 | ✗ | goto invalid; | |
| 22021 | } | ||
| 22022 | 9287 | } | |
| 22023 | } | ||
| 22024 | } | ||
| 22025 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 666 times.
|
666 | } |
| 22026 | else | ||
| 22027 | { | ||
| 22028 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | std::vector<std::tuple<std::string, int32_t, std::function<int32_t()>>> hardcoded_sections = { |
| 22029 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "Rules", ID_RULES, [&](){ return readrules(f, &tempheader); }}, |
| 22030 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Strings", ID_STRINGS, [&](){ return readstrings(f, &tempheader); }}, |
| 22031 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Doors", ID_DOORS, [&](){ return readdoorcombosets(f, &tempheader); }}, |
| 22032 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "DMaps", ID_DMAPS, [&](){ return readdmaps(f, &tempheader, tempheader.zelda_version, tempheader.build, 0, MAXDMAPS); }}, |
| 22033 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Misc. Data", ID_MISC, [&](){ return readmisc(f, &tempheader, Misc); }}, |
| 22034 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Items", ID_ITEMS, [&](){ return readitems(f, tempheader.zelda_version, tempheader.build); }}, |
| 22035 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Weapons", ID_WEAPONS, [&](){ return readweapons(f, &tempheader); }}, |
| 22036 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "Custom Guy Data", ID_GUYS, [&](){ return readguys(f, &tempheader); }}, |
| 22037 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Maps", ID_MAPS, [&](){ return readmaps(f, &tempheader); }}, |
| 22038 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Combos", ID_COMBOS, [&](){ return readcombos(f, &tempheader, tempheader.zelda_version, tempheader.build, 0, MAXCOMBOS); }}, |
| 22039 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Color Data", ID_CSETS, [&](){ return readcolordata(f, Misc, tempheader.zelda_version, tempheader.build, 0, newerpdTOTAL); }}, |
| 22040 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Tiles", ID_TILES, [&](){ return readtiles(f, newtilebuf, &tempheader, tempheader.zelda_version, tempheader.build, 0, NEWMAXTILES, false); }}, |
| 22041 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "Tunes", ID_MIDIS, [&](){ return readtunes(f, &tempheader, tunes); }}, |
| 22042 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "Cheat Codes", ID_CHEATS, [&](){ return readcheatcodes(f, &tempheader); }}, |
| 22043 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "Init. Data", ID_INITDATA, [&](){ return readinitdata(f, &tempheader); }}, |
| 22044 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "Custom Player Sprite Data", ID_HEROSPRITES, [&](){ return readherosprites2(f, -1, 0); }}, |
| 22045 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "Up Default Item Drop Sets", ID_ITEMDROPSETS, [&](){ return readitemdropsets(f, -1, 0); }}, |
| 22046 | }; | ||
| 22047 | |||
| 22048 | 24 | legacy_skip_flags = skip_flags; | |
| 22049 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 408 times.
|
1250 | for (auto& [desc, section_id, fn] : hardcoded_sections) |
| 22050 | { | ||
| 22051 |
1/2✓ Branch 0 taken 408 times.
✗ Branch 1 not taken.
|
408 | int section_enum = section_id_to_enum(section_id); |
| 22052 |
2/4✓ Branch 0 taken 408 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 408 times.
✗ Branch 3 not taken.
|
408 | bool skip = section_enum >= 0 && get_bit(skip_flags, section_enum); |
| 22053 |
2/2✓ Branch 0 taken 392 times.
✓ Branch 1 taken 16 times.
|
408 | if (skip) |
| 22054 | { | ||
| 22055 | // Nothing to read. | ||
| 22056 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 15 times.
|
16 | if (section_id == ID_RULES) |
| 22057 | 1 | continue; | |
| 22058 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 14 times.
|
15 | if (section_id == ID_GUYS) |
| 22059 | 1 | continue; | |
| 22060 | |||
| 22061 | // Haven't looked at how to skip these, because we don't need to currently: the only | ||
| 22062 | // usage of skip_flags currently is all off except: header and tiles (see `load_imagebuf`). | ||
| 22063 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 13 times.
|
14 | if (section_id == ID_MIDIS) |
| 22064 | 1 | continue; | |
| 22065 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 12 times.
|
13 | if (section_id == ID_CHEATS) |
| 22066 | 1 | continue; | |
| 22067 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 11 times.
|
12 | if (section_id == ID_INITDATA) |
| 22068 | 1 | continue; | |
| 22069 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 10 times.
|
11 | if (section_id == ID_HEROSPRITES) |
| 22070 | 1 | continue; | |
| 22071 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 9 times.
|
10 | if (section_id == ID_ITEMDROPSETS) |
| 22072 | 1 | continue; | |
| 22073 | 9 | } | |
| 22074 | |||
| 22075 | // Would be nice, but old sections mostly did not save section sizes. We could advance by | ||
| 22076 | // a specific amount, but it'd be a lot of work to get it right. So, for old quests, let's just | ||
| 22077 | // read all the sections even if requested to skip some. | ||
| 22078 | // if (int retval = maybe_skip_section(f, section_id, skip_flags); retval != qe_OK) | ||
| 22079 | // { | ||
| 22080 | // if (retval == qe_cancel) | ||
| 22081 | // continue; | ||
| 22082 | // checkstatus(retval); | ||
| 22083 | // } | ||
| 22084 | |||
| 22085 |
3/6✓ Branch 0 taken 401 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 401 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 401 times.
✗ Branch 5 not taken.
|
802 | box_out(fmt::format("Reading {}...", desc).c_str()); |
| 22086 |
1/2✓ Branch 0 taken 401 times.
✗ Branch 1 not taken.
|
401 | ret = fn(); |
| 22087 |
1/9✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 401 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
401 | checkstatus(ret); |
| 22088 |
1/2✓ Branch 0 taken 401 times.
✗ Branch 1 not taken.
|
401 | box_out("okay."); |
| 22089 |
1/2✓ Branch 0 taken 401 times.
✗ Branch 1 not taken.
|
401 | box_eol(); |
| 22090 | } | ||
| 22091 | 24 | legacy_skip_flags = nullptr; | |
| 22092 | |||
| 22093 |
3/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 23 times.
✓ Branch 3 taken 1 times.
|
24 | if(!get_bit(skip_flags, skip_subscreens)) |
| 22094 | { | ||
| 22095 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | setupsubscreens(); |
| 22096 | |||
| 22097 |
2/2✓ Branch 0 taken 11776 times.
✓ Branch 1 taken 23 times.
|
11799 | for(int32_t i=0; i<MAXDMAPS; ++i) |
| 22098 | { | ||
| 22099 | 11776 | int32_t type=DMaps[i].type&dmfTYPE; | |
| 22100 |
2/2✓ Branch 0 taken 44 times.
✓ Branch 1 taken 11732 times.
|
11776 | DMaps[i].active_subscreen=(type == dmOVERW || type == dmBSOVERW)?0:1; |
| 22101 | 11776 | DMaps[i].passive_subscreen=(get_qr(qr_ENABLEMAGIC))?0:1; | |
| 22102 | 11776 | } | |
| 22103 | 23 | } | |
| 22104 | |||
| 22105 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | box_out("Setting Up Default Sound Effects..."); |
| 22106 | |||
| 22107 |
3/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 23 times.
|
24 | if(!get_bit(skip_flags, skip_sfx)) |
| 22108 | 23 | setupsfx(); | |
| 22109 | |||
| 22110 |
3/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 23 times.
|
24 | if(!get_bit(skip_flags, skip_favorites)) |
| 22111 | 23 | init_favorites(); | |
| 22112 | |||
| 22113 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | box_out("okay."); |
| 22114 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | box_eol(); |
| 22115 |
1/3✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
24 | } |
| 22116 | |||
| 22117 | 690 | init_spritelists(); | |
| 22118 | |||
| 22119 | // check data | ||
| 22120 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 690 times.
|
690 | if(f) |
| 22121 | { | ||
| 22122 | 690 | pack_fclose(f); | |
| 22123 | 690 | } | |
| 22124 | 690 | clear_quest_tmpfile(); | |
| 22125 | |||
| 22126 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 690 times.
|
690 | if(!oldquest) |
| 22127 | { | ||
| 22128 |
1/2✓ Branch 0 taken 690 times.
✗ Branch 1 not taken.
|
690 | if(exists(tmpfilename)) |
| 22129 | { | ||
| 22130 | ✗ | delete_file(tmpfilename); | |
| 22131 | ✗ | } | |
| 22132 | 690 | } | |
| 22133 | |||
| 22134 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 690 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
690 | if(fixffcs && combosread && mapsread) |
| 22135 | { | ||
| 22136 | ✗ | for(int32_t i=0; i<map_count; i++) | |
| 22137 | { | ||
| 22138 | ✗ | for(int32_t j=0; j<MAPSCRS; j++) | |
| 22139 | { | ||
| 22140 | ✗ | TheMaps[(i*MAPSCRS)+j].ensureFFC(32); | |
| 22141 | ✗ | for(int32_t m=0; m<32; m++) | |
| 22142 | { | ||
| 22143 | ✗ | if(combobuf[TheMaps[(i*MAPSCRS)+j].ffcs[m].data].type == cCHANGE) | |
| 22144 | ✗ | TheMaps[(i*MAPSCRS)+j].ffcs[m].flags|=ffc_changer; | |
| 22145 | ✗ | } | |
| 22146 | ✗ | } | |
| 22147 | ✗ | } | |
| 22148 | ✗ | } | |
| 22149 | |||
| 22150 |
5/6✓ Branch 0 taken 60 times.
✓ Branch 1 taken 630 times.
✓ Branch 2 taken 59 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 59 times.
✗ Branch 5 not taken.
|
690 | if(get_qr(qr_CONTFULL_DEP) && !get_bit(skip_flags, skip_rules) && !get_bit(skip_flags, skip_initdata)) |
| 22151 | { | ||
| 22152 | 59 | set_qr(qr_CONTFULL_DEP, 0); | |
| 22153 | 59 | zinit.flags.set(INIT_FL_CONTPERCENT,true); | |
| 22154 | 59 | zinit.cont_heart=100; | |
| 22155 | 59 | zinit.counter[crLIFE]=zinit.mcounter[crLIFE]; | |
| 22156 | 59 | } | |
| 22157 | |||
| 22158 | 690 | box_out("Done."); | |
| 22159 | 690 | box_eol(); | |
| 22160 | 690 | box_end(false); | |
| 22161 | |||
| 22162 |
2/2✓ Branch 0 taken 275 times.
✓ Branch 1 taken 415 times.
|
690 | if(!get_bit(skip_flags, skip_header)) |
| 22163 | { | ||
| 22164 | 415 | memcpy(Header, &tempheader, sizeof(tempheader)); | |
| 22165 | 415 | } | |
| 22166 |
2/2✓ Branch 0 taken 276 times.
✓ Branch 1 taken 414 times.
|
690 | if(!get_bit(skip_flags, skip_zinfo)) |
| 22167 | { | ||
| 22168 | 414 | ZI.copyFrom(tempzi); | |
| 22169 | 414 | } | |
| 22170 | |||
| 22171 |
2/2✓ Branch 0 taken 414 times.
✓ Branch 1 taken 276 times.
|
690 | if(get_bit(skip_flags, skip_maps)) |
| 22172 | { | ||
| 22173 | 276 | map_count=old_map_count; | |
| 22174 | 276 | } | |
| 22175 | |||
| 22176 |
2/2✓ Branch 0 taken 414 times.
✓ Branch 1 taken 276 times.
|
690 | if(get_bit(skip_flags, skip_rules)) |
| 22177 | { | ||
| 22178 | 276 | memcpy(quest_rules, old_quest_rules, QUESTRULES_NEW_SIZE); | |
| 22179 | 276 | memcpy(extra_rules, old_extra_rules, EXTRARULES_SIZE); | |
| 22180 | 276 | unpack_qrs(); | |
| 22181 | 276 | } | |
| 22182 | |||
| 22183 |
2/2✓ Branch 0 taken 414 times.
✓ Branch 1 taken 276 times.
|
690 | if(get_bit(skip_flags, skip_midis)) |
| 22184 | { | ||
| 22185 | 276 | memcpy(midi_flags, old_midi_flags, MIDIFLAGS_SIZE); | |
| 22186 | 276 | } | |
| 22187 | |||
| 22188 |
2/2✓ Branch 0 taken 666 times.
✓ Branch 1 taken 24 times.
|
690 | if( FFCore.quest_format[vZelda] < 0x210 ) |
| 22189 | { | ||
| 22190 | 24 | zprint2("\n[QUEST METADATA]\n"); | |
| 22191 | |||
| 22192 |
3/13✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 12 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 6 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
|
24 | switch(FFCore.quest_format[vZelda]) |
| 22193 | { | ||
| 22194 | case 0x193: | ||
| 22195 | { | ||
| 22196 | ✗ | zprint2("Last saved in version: 1.93, Beta %d\n", FFCore.quest_format[vBuild]); break; | |
| 22197 | } | ||
| 22198 | case 0x192: | ||
| 22199 | { | ||
| 22200 | 6 | zprint2("Last saved in version: 1.92, Beta %d\n", FFCore.quest_format[vBuild]); break; | |
| 22201 | } | ||
| 22202 | case 0x190: | ||
| 22203 | { | ||
| 22204 | 12 | zprint2("Last saved in version: 1.90"); | |
| 22205 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
12 | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); |
| 22206 | 12 | else zprint2("\n"); | |
| 22207 | 12 | break; | |
| 22208 | } | ||
| 22209 | case 0x188: | ||
| 22210 | { | ||
| 22211 | ✗ | zprint2("Last saved in version: 1.88"); | |
| 22212 | ✗ | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); | |
| 22213 | ✗ | else zprint2("\n"); | |
| 22214 | ✗ | break; | |
| 22215 | } | ||
| 22216 | case 0x187: | ||
| 22217 | { | ||
| 22218 | ✗ | zprint2("Last saved in version: 1.87"); | |
| 22219 | ✗ | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); | |
| 22220 | ✗ | else zprint2("\n"); | |
| 22221 | ✗ | break; | |
| 22222 | } | ||
| 22223 | case 0x186: | ||
| 22224 | { | ||
| 22225 | ✗ | zprint2("Last saved in version: 1.86"); | |
| 22226 | ✗ | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); | |
| 22227 | ✗ | else zprint2("\n"); | |
| 22228 | ✗ | break; | |
| 22229 | } | ||
| 22230 | case 0x185: | ||
| 22231 | { | ||
| 22232 | ✗ | zprint2("Last saved in version: 1.85"); | |
| 22233 | ✗ | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); | |
| 22234 | ✗ | else zprint2("\n"); | |
| 22235 | ✗ | break; | |
| 22236 | } | ||
| 22237 | case 0x184: | ||
| 22238 | { | ||
| 22239 | 6 | zprint2("Last saved in version: 1.84"); | |
| 22240 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); |
| 22241 | 6 | else zprint2("\n"); | |
| 22242 | 6 | break; | |
| 22243 | } | ||
| 22244 | case 0x183: | ||
| 22245 | { | ||
| 22246 | ✗ | zprint2("Last saved in version: 1.83"); | |
| 22247 | ✗ | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); | |
| 22248 | ✗ | else zprint2("\n"); | |
| 22249 | ✗ | break; | |
| 22250 | } | ||
| 22251 | case 0x182: | ||
| 22252 | { | ||
| 22253 | ✗ | zprint2("Last saved in version: 1.82"); | |
| 22254 | ✗ | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); | |
| 22255 | ✗ | else zprint2("\n"); | |
| 22256 | ✗ | break; | |
| 22257 | } | ||
| 22258 | case 0x181: | ||
| 22259 | { | ||
| 22260 | ✗ | zprint2("Last saved in version: 1.81"); | |
| 22261 | ✗ | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); | |
| 22262 | ✗ | else zprint2("\n"); | |
| 22263 | ✗ | break; | |
| 22264 | } | ||
| 22265 | case 0x180: | ||
| 22266 | { | ||
| 22267 | ✗ | zprint2("Last saved in version: 1.80"); | |
| 22268 | ✗ | if ( FFCore.quest_format[vBuild] ) zprint2(", Beta/Build %d\n", FFCore.quest_format[vBuild]); | |
| 22269 | ✗ | else zprint2("\n"); | |
| 22270 | ✗ | break; | |
| 22271 | } | ||
| 22272 | default: | ||
| 22273 | { | ||
| 22274 | ✗ | zprint2("Last saved in version: %x, Beta %d\n", FFCore.quest_format[vZelda],FFCore.quest_format[vBuild]); break; | |
| 22275 | } | ||
| 22276 | } | ||
| 22277 | 24 | } | |
| 22278 | |||
| 22279 |
1/2✓ Branch 0 taken 690 times.
✗ Branch 1 not taken.
|
690 | if(loading_tileset_flags & TILESET_CLEARMAPS) |
| 22280 | { | ||
| 22281 | ✗ | TheMaps.clear(); | |
| 22282 | ✗ | TheMaps.resize(MAPSCRS*1); | |
| 22283 | ✗ | map_count = 1; | |
| 22284 | ✗ | map_autolayers.clear(); | |
| 22285 | ✗ | map_autolayers.resize(6*1); | |
| 22286 | ✗ | } | |
| 22287 |
1/2✓ Branch 0 taken 690 times.
✗ Branch 1 not taken.
|
690 | if(loading_tileset_flags & TILESET_CLEARHEADER) |
| 22288 | { | ||
| 22289 | ✗ | memset(Header->password, 0, sizeof(Header->password)); | |
| 22290 | ✗ | memset(Header->minver, 0, sizeof(Header->minver)); | |
| 22291 | ✗ | memset(Header->title, 0, sizeof(Header->title)); | |
| 22292 | ✗ | memset(Header->author, 0, sizeof(Header->author)); | |
| 22293 | ✗ | memset(Header->version, 0, sizeof(Header->version)); | |
| 22294 | ✗ | Header->use_keyfile = 0; | |
| 22295 | ✗ | Header->dirty_password = false; | |
| 22296 | cvs_MD5Context ctx; | ||
| 22297 | ✗ | cvs_MD5Init(&ctx); | |
| 22298 | ✗ | cvs_MD5Update(&ctx, (const uint8_t*)"", 0); | |
| 22299 | ✗ | cvs_MD5Final(Header->pwd_hash, &ctx); | |
| 22300 | ✗ | } | |
| 22301 | |||
| 22302 |
2/2✓ Branch 0 taken 276 times.
✓ Branch 1 taken 414 times.
|
690 | if (!get_bit(skip_flags, skip_maps)) |
| 22303 | { | ||
| 22304 | // Not needed, so release its memory. | ||
| 22305 | 414 | old_combo_pages = {}; | |
| 22306 | 414 | } | |
| 22307 | |||
| 22308 | 690 | return qe_OK; | |
| 22309 | |||
| 22310 | invalid: | ||
| 22311 | // TODO: It's too easy to forget to jump to this label, and accidentally leave the file open. | ||
| 22312 | // Should wrap PACKFILE in a std::unique_pointer with a custom deallocator. | ||
| 22313 | ✗ | box_out("error."); | |
| 22314 | ✗ | box_eol(); | |
| 22315 | ✗ | box_end(true); | |
| 22316 | |||
| 22317 | ✗ | pack_fclose(f); | |
| 22318 | |||
| 22319 | ✗ | if(!oldquest) | |
| 22320 | { | ||
| 22321 | ✗ | if(exists(tmpfilename)) | |
| 22322 | { | ||
| 22323 | ✗ | delete_file(tmpfilename); | |
| 22324 | ✗ | } | |
| 22325 | ✗ | } | |
| 22326 | |||
| 22327 | ✗ | return qe_invalid; | |
| 22328 | |||
| 22329 | 690 | } | |
| 22330 | |||
| 22331 | static bool _is_loading_quest; | ||
| 22332 | |||
| 22333 | ✗ | bool is_loading_quest() | |
| 22334 | { | ||
| 22335 | ✗ | return _is_loading_quest; | |
| 22336 | } | ||
| 22337 | |||
| 22338 | 275 | std::string get_last_loaded_qstpath() | |
| 22339 | { | ||
| 22340 | 275 | return last_loaded_qstpath; | |
| 22341 | } | ||
| 22342 | |||
| 22343 | 690 | int32_t loadquest(const char *filename, zquestheader *Header, miscQdata *Misc, | |
| 22344 | zctune *tunes, bool show_progress, byte *skip_flags, byte printmetadata, | ||
| 22345 | bool report, byte qst_num, dword tilesetflags) | ||
| 22346 | { | ||
| 22347 | 690 | loading_tileset_flags = tilesetflags; | |
| 22348 | 690 | const char* basename = get_filename(filename); | |
| 22349 | 690 | zapp_reporting_add_breadcrumb("load_quest", basename); | |
| 22350 | 690 | zapp_reporting_set_tag("qst.filename", basename); | |
| 22351 | |||
| 22352 | 690 | last_loaded_qstpath = filename; | |
| 22353 | 690 | loading_qst_name = filename; | |
| 22354 | 690 | loading_qst_num = qst_num; | |
| 22355 | // In CI, builds are cached for replay tests, which can result in their build dates being earlier than what it would be locally. | ||
| 22356 | // So to avoid a more-recently updated .qst file from hitting the "last saved in a newer version" prompt, we disable in CI. | ||
| 22357 |
1/2✓ Branch 0 taken 690 times.
✗ Branch 1 not taken.
|
690 | if (!is_ci()) |
| 22358 | ✗ | loadquest_report = report; | |
| 22359 | |||
| 22360 | 690 | _is_loading_quest = true; | |
| 22361 | 690 | auto start = std::chrono::steady_clock::now(); | |
| 22362 | 690 | zprint2("Loading qst: %s\n", filename); | |
| 22363 | 690 | int32_t ret = _lq_int(filename, Header, Misc, tunes, show_progress, skip_flags, printmetadata); | |
| 22364 | 690 | int32_t load_ms = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - start).count(); | |
| 22365 | 690 | zprint2("Time to load qst: %d ms\n", load_ms); | |
| 22366 | 690 | _is_loading_quest = false; | |
| 22367 |
1/2✓ Branch 0 taken 690 times.
✗ Branch 1 not taken.
|
690 | if (ret) |
| 22368 | ✗ | zprint2("Error: %s\n", qst_error[ret]); | |
| 22369 | |||
| 22370 |
2/2✓ Branch 0 taken 689 times.
✓ Branch 1 taken 1 times.
|
690 | if(show_progress) |
| 22371 | { | ||
| 22372 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if(ret) |
| 22373 | { | ||
| 22374 | ✗ | box_out("-- Error loading quest file! --"); | |
| 22375 | ✗ | box_out(fmt::format("Error: {}", qst_error[ret]).c_str()); | |
| 22376 | ✗ | box_end(true); | |
| 22377 | ✗ | } | |
| 22378 | 1 | else box_end(false); | |
| 22379 | 1 | } | |
| 22380 | |||
| 22381 | 690 | load_tmp_zi = NULL; | |
| 22382 | 690 | loading_qst_name = NULL; | |
| 22383 | 690 | loadquest_report = false; | |
| 22384 | 690 | loading_qst_num = 0; | |
| 22385 | |||
| 22386 | 690 | zapp_reporting_set_tag("qst.author", Header->author); | |
| 22387 | 690 | zapp_reporting_set_tag("qst.title", Header->title); | |
| 22388 | 690 | zapp_reporting_set_tag("qst.zc_version", Header->getVerStr()); | |
| 22389 | |||
| 22390 | 690 | return ret; | |
| 22391 | ✗ | } | |
| 22392 |